Skip to content

Commit 3e44a46

Browse files
committed
Removed Claims::getHashes and Claims::getGuids
1 parent 70d679f commit 3e44a46

3 files changed

Lines changed: 2 additions & 74 deletions

File tree

RELEASE-NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Removed `Claims::getByRank` and `Claims::getByRanks` (you can use `StatementList::getWithRank` instead)
1414
* Removed `Claims::getMainSnaks` (you can use `StatementList::getMainSnaks` instead)
1515
* Removed `Claims::getClaimsForProperty` (you can use `StatementList::getWithPropertyId` instead)
16+
* Removed `Claims::getHashes`
17+
* Removed `Claims::getGuids`
1618

1719
## Version 2.6.0 (2015-03-08)
1820

src/Claim/Claims.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -279,38 +279,6 @@ public function offsetUnset( $guid ) {
279279
parent::offsetUnset( $key );
280280
}
281281

282-
/**
283-
* Get array of Claim guids
284-
*
285-
* @since 0.4
286-
*
287-
* @return string[]
288-
*/
289-
public function getGuids() {
290-
return array_map( function ( Claim $claim ) {
291-
return $claim->getGuid();
292-
}, iterator_to_array( $this ) );
293-
}
294-
295-
/**
296-
* Returns a map from GUIDs to claim hashes.
297-
*
298-
* @since 0.4
299-
*
300-
* @return string[]
301-
*/
302-
public function getHashes() {
303-
$snaks = array();
304-
305-
/* @var Claim $claim */
306-
foreach ( $this as $claim ) {
307-
$guid = $claim->getGuid();
308-
$snaks[$guid] = $claim->getHash();
309-
}
310-
311-
return $snaks;
312-
}
313-
314282
/**
315283
* Returns a hash based on the value of the object.
316284
* The hash is based on the hashes of the claims contained,

tests/unit/Claim/ClaimsTest.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -384,48 +384,6 @@ public function testGuidNormalization() {
384384
$this->assertEquals( $claim2, $claims->getClaimWithGuid( $claim2UpperGuid ) );
385385
}
386386

387-
public function testGetGuids() {
388-
$claims = new Claims( array(
389-
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P42' ) ) ),
390-
$this->makeClaim( new PropertySomeValueSnak( new PropertyId( 'P42' ) ) ),
391-
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P23' ) ) ),
392-
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P9000' ) ) ),
393-
) );
394-
395-
$guids = $claims->getGuids();
396-
$this->assertInternalType( 'array', $guids );
397-
$this->assertSameSize( $claims, $guids );
398-
399-
foreach ( $guids as $guid ) {
400-
$this->assertInternalType( 'string', $guid );
401-
$this->assertTrue( $claims->hasClaimWithGuid( $guid ) );
402-
}
403-
}
404-
405-
public function testGetHashes() {
406-
$claims = new Claims( array(
407-
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P42' ) ) ),
408-
$this->makeClaim( new PropertySomeValueSnak( new PropertyId( 'P42' ) ) ),
409-
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P23' ) ) ),
410-
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P9000' ) ) ),
411-
) );
412-
413-
$hashes = $claims->getHashes();
414-
$this->assertInternalType( 'array', $hashes );
415-
$this->assertContainsOnly( 'string', $hashes );
416-
$this->assertSameSize( $claims, $hashes );
417-
418-
$hashSet = array_flip( $hashes );
419-
420-
/**
421-
* @var Claim $claim
422-
*/
423-
foreach ( $claims as $claim ) {
424-
$hash = $claim->getHash();
425-
$this->assertArrayHasKey( $hash, $hashSet );
426-
}
427-
}
428-
429387
/**
430388
* Attempts to add Claims with no GUID set will fail.
431389
*/

0 commit comments

Comments
 (0)