Skip to content

Commit 70d679f

Browse files
committed
Removed Claims::getMainSnaks and Claims::getClaimsForProperty
1 parent 81f68ed commit 70d679f

3 files changed

Lines changed: 2 additions & 76 deletions

File tree

RELEASE-NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* Removed `ClaimListAccess`
1212
* Removed `Claims::getBestClaims` (you can use `StatementList::getBestStatements` instead)
1313
* Removed `Claims::getByRank` and `Claims::getByRanks` (you can use `StatementList::getWithRank` instead)
14+
* Removed `Claims::getMainSnaks` (you can use `StatementList::getMainSnaks` instead)
15+
* Removed `Claims::getClaimsForProperty` (you can use `StatementList::getWithPropertyId` instead)
1416

1517
## Version 2.6.0 (2015-03-08)
1618

src/Claim/Claims.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -292,44 +292,6 @@ public function getGuids() {
292292
}, iterator_to_array( $this ) );
293293
}
294294

295-
/**
296-
* Returns the claims for the given property.
297-
*
298-
* @since 0.4
299-
*
300-
* @param PropertyId $propertyId
301-
*
302-
* @return Claims
303-
*/
304-
public function getClaimsForProperty( PropertyId $propertyId ) {
305-
$byPropertyIdGrouper = new ByPropertyIdGrouper( $this );
306-
307-
if ( !$byPropertyIdGrouper->hasPropertyId( $propertyId ) ) {
308-
return new self();
309-
}
310-
311-
return new self( $byPropertyIdGrouper->getByPropertyId( $propertyId ) );
312-
}
313-
314-
/**
315-
* Returns the main Snaks of the claims in this list.
316-
*
317-
* @since 0.4
318-
*
319-
* @return Snak[]
320-
*/
321-
public function getMainSnaks() {
322-
$snaks = array();
323-
324-
/* @var Claim $claim */
325-
foreach ( $this as $claim ) {
326-
$guid = $claim->getGuid();
327-
$snaks[$guid] = $claim->getMainSnak();
328-
}
329-
330-
return $snaks;
331-
}
332-
333295
/**
334296
* Returns a map from GUIDs to claim hashes.
335297
*

tests/unit/Claim/ClaimsTest.php

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

387-
public function testGetMainSnaks() {
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-
$snaks = $claims->getMainSnaks();
396-
$this->assertInternalType( 'array', $snaks );
397-
$this->assertSameSize( $claims, $snaks );
398-
399-
foreach ( $snaks as $guid => $snak ) {
400-
$this->assertInstanceOf( 'Wikibase\DataModel\Snak\Snak', $snak );
401-
$this->assertTrue( $claims->hasClaimWithGuid( $guid ) );
402-
}
403-
}
404-
405387
public function testGetGuids() {
406388
$claims = new Claims( array(
407389
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P42' ) ) ),
@@ -444,26 +426,6 @@ public function testGetHashes() {
444426
}
445427
}
446428

447-
public function testGetClaimsForProperty() {
448-
$claims = new Claims( array(
449-
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P42' ) ) ),
450-
$this->makeClaim( new PropertySomeValueSnak( new PropertyId( 'P42' ) ) ),
451-
$this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P23' ) ) ),
452-
) );
453-
454-
$matches = $claims->getClaimsForProperty( new PropertyId( 'P42' ) );
455-
$this->assertInstanceOf( 'Wikibase\DataModel\Claim\Claims', $claims );
456-
$this->assertSame( 2, $matches->count() );
457-
458-
$matches = $claims->getClaimsForProperty( new PropertyId( 'P23' ) );
459-
$this->assertInstanceOf( 'Wikibase\DataModel\Claim\Claims', $claims );
460-
$this->assertSame( 1, $matches->count() );
461-
462-
$matches = $claims->getClaimsForProperty( new PropertyId( 'P9000' ) );
463-
$this->assertInstanceOf( 'Wikibase\DataModel\Claim\Claims', $claims );
464-
$this->assertSame( 0, $matches->count() );
465-
}
466-
467429
/**
468430
* Attempts to add Claims with no GUID set will fail.
469431
*/

0 commit comments

Comments
 (0)