Skip to content

Commit 9528b8f

Browse files
committed
Remove getBestClaimPerProperty from ClaimList
The rank is a Statement concept, not a Claim one
1 parent debf0de commit 9528b8f

2 files changed

Lines changed: 0 additions & 54 deletions

File tree

src/Claim/ClaimList.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,6 @@ public function __construct( $claims = array() ) {
4141
$this->claims = $claims;
4242
}
4343

44-
/**
45-
* Returns the best claims per property.
46-
* The best claims are those with the highest rank for a particular property.
47-
* Deprecated ranks are never included.
48-
*
49-
* Caution: the ranking is done per property, not globally, as in the Claims class.
50-
*
51-
* @return self
52-
*/
53-
public function getBestClaimPerProperty() {
54-
$claimList = new self();
55-
56-
foreach ( $this->getPropertyIds() as $propertyId ) {
57-
$claims = new Claims( $this->claims );
58-
$claimList->addClaims( $claims->getClaimsForProperty( $propertyId )->getBestClaims() );
59-
}
60-
61-
return $claimList;
62-
}
63-
6444
/**
6545
* Returns the property ids used by the claims.
6646
* The keys of the returned array hold the serializations of the property ids.
@@ -77,12 +57,6 @@ public function getPropertyIds() {
7757
return $propertyIds;
7858
}
7959

80-
private function addClaims( Claims $claims ) {
81-
foreach ( $claims as $claim ) {
82-
$this->addClaim( $claim );
83-
}
84-
}
85-
8660
public function addClaim( Claim $claim ) {
8761
$this->claims[] = $claim;
8862
}

tests/unit/Claim/ClaimListTest.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -89,34 +89,6 @@ public function testCanIterate() {
8989
}
9090
}
9191

92-
public function testGetBestClaimPerProperty() {
93-
$list = new ClaimList( array(
94-
$this->getStubClaim( 1, 'one', Claim::RANK_PREFERRED ),
95-
$this->getStubClaim( 1, 'two', Claim::RANK_NORMAL ),
96-
$this->getStubClaim( 1, 'three', Claim::RANK_PREFERRED ),
97-
98-
$this->getStubClaim( 2, 'four', Claim::RANK_DEPRECATED ),
99-
100-
$this->getStubClaim( 3, 'five', Claim::RANK_DEPRECATED ),
101-
$this->getStubClaim( 3, 'six', Claim::RANK_NORMAL ),
102-
103-
$this->getStubClaim( 4, 'seven', Claim::RANK_PREFERRED ),
104-
$this->getStubClaim( 4, 'eight', Claim::RANK_TRUTH ),
105-
) );
106-
107-
$this->assertEquals(
108-
array(
109-
$this->getStubClaim( 1, 'one', Claim::RANK_PREFERRED ),
110-
$this->getStubClaim( 1, 'three', Claim::RANK_PREFERRED ),
111-
112-
$this->getStubClaim( 3, 'six', Claim::RANK_NORMAL ),
113-
114-
$this->getStubClaim( 4, 'eight', Claim::RANK_TRUTH ),
115-
),
116-
$list->getBestClaimPerProperty()->toArray()
117-
);
118-
}
119-
12092
public function testGetUniqueMainSnaksReturnsListWithoutDuplicates() {
12193
$list = new ClaimList( array(
12294
$this->getClaimWithSnak( 1, 'foo' ),

0 commit comments

Comments
 (0)