From 4f058f4ea014a3741b288de2d998d5b5ded2094c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thiemo=20M=C3=A4ttig?= Date: Thu, 12 Feb 2015 10:16:31 +0100 Subject: [PATCH] Drop ClaimListAccess interface --- src/Claim/ClaimListAccess.php | 91 ------------------------ src/Claim/Claims.php | 16 +---- src/Entity/Entity.php | 2 - tests/unit/Claim/ClaimListAccessTest.php | 79 -------------------- 4 files changed, 1 insertion(+), 187 deletions(-) delete mode 100644 src/Claim/ClaimListAccess.php delete mode 100644 tests/unit/Claim/ClaimListAccessTest.php diff --git a/src/Claim/ClaimListAccess.php b/src/Claim/ClaimListAccess.php deleted file mode 100644 index 4b4099f2..00000000 --- a/src/Claim/ClaimListAccess.php +++ /dev/null @@ -1,91 +0,0 @@ - - */ -interface ClaimListAccess { - - /** - * Adds the provided claims to the list. If a claim with the same GUID is already in the list, - * it is replaced. Specifying an index within the list of claims will shift existing claims. If - * the index where to insert the claim in the list of claims is not specified, the claim will be - * appended to the list. - * - * @since 0.2 - * - * @param Claim $claim - * @param int|null $index - */ - public function addClaim( Claim $claim, $index = null ); - - /** - * Returns if the list contains a claim with the same GUID as the provided claim. - * - * @since 0.2 - * - * @param Claim $claim - * - * @return boolean - */ - public function hasClaim( Claim $claim ); - - /** - * Returns the index of a claim or false if the claim could not be found. - * - * @since 0.5 - * - * @param Claim $claim - * - * @return int|boolean - */ - public function indexOf( Claim $claim ); - - /** - * Removes the claim with the same GUID as the provided claim if such a claim exists in the list. - * If the claim is not in the list, the call has no effect. - * - * @since 0.2 - * - * @param Claim $claim - */ - public function removeClaim( Claim $claim ); - - /** - * Returns if the list contains a claim with the the provided GUID. - * - * @since 0.3 - * - * @param string $claimGuid - * - * @return boolean - */ - public function hasClaimWithGuid( $claimGuid ); - - /** - * Removes the claim with the provided GUID if such a claim exists in the list. - * - * @since 0.3 - * - * @param string $claimGuid - */ - public function removeClaimWithGuid( $claimGuid ); - - /** - * Returns the claim with the provided GUID or null if there is no such claim. - * - * @since 0.3 - * - * @param string $claimGuid - * - * @return Claim|null - */ - public function getClaimWithGuid( $claimGuid ); - -} diff --git a/src/Claim/Claims.php b/src/Claim/Claims.php index 5fb88075..0563cda0 100644 --- a/src/Claim/Claims.php +++ b/src/Claim/Claims.php @@ -22,7 +22,7 @@ * @author Daniel Kinzler * @author H. Snater < mediawiki@snater.com > */ -class Claims extends ArrayObject implements ClaimListAccess, Hashable, Comparable { +class Claims extends ArrayObject implements Hashable, Comparable { /** * @see GenericArrayObject::__construct @@ -82,8 +82,6 @@ private function getClaimKey( Claim $claim ) { } /** - * @see ClaimListAccess::addClaim - * * @since 0.1 * * @param Claim $claim @@ -122,8 +120,6 @@ private function insertClaimAtIndex( Claim $claim, $index ) { } /** - * @see ClaimListAccess::hasClaim - * * @since 0.1 * * @param Claim $claim @@ -142,8 +138,6 @@ public function hasClaim( Claim $claim ) { } /** - * @see ClaimListAccess::indexOf - * * @since 0.5 * * @param Claim $claim @@ -168,8 +162,6 @@ public function indexOf( Claim $claim ) { } /** - * @see ClaimListAccess::removeClaim - * * @since 0.1 * * @param Claim $claim @@ -189,8 +181,6 @@ public function removeClaim( Claim $claim ) { } /** - * @see ClaimListAccess::hasClaimWithGuid - * * @since 0.3 * * @param string $claimGuid @@ -202,8 +192,6 @@ public function hasClaimWithGuid( $claimGuid ) { } /** - * @see ClaimListAccess::removeClaimWithGuid - * * @since 0.3 * * @param string $claimGuid @@ -215,8 +203,6 @@ public function removeClaimWithGuid( $claimGuid ) { } /** - * @see ClaimListAccess::getClaimWithGuid - * * @since 0.3 * * @param string $claimGuid diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index d7b091de..ae099671 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -352,8 +352,6 @@ public function copy() { } /** - * @see ClaimListAccess::addClaim - * * @since 0.3 * @deprecated since 1.0 * diff --git a/tests/unit/Claim/ClaimListAccessTest.php b/tests/unit/Claim/ClaimListAccessTest.php deleted file mode 100644 index b5173338..00000000 --- a/tests/unit/Claim/ClaimListAccessTest.php +++ /dev/null @@ -1,79 +0,0 @@ - - */ -class ClaimListAccessTest extends \PHPUnit_Framework_TestCase { - - public function claimTestProvider() { - $claims = array(); - - $claims[] = new Claim( new PropertyNoValueSnak( - new PropertyId( 'P42' ) - ) ); - $claims[] = new Claim( new PropertyValueSnak( - new PropertyId( 'P23' ), - new StringValue( 'ohi' ) - ) ); - - $lists = array(); - - $lists[] = new Claims(); - - $argLists = array(); - - /** - * @var Claim $claim - */ - foreach ( $claims as $i => $claim ) { - $claim->setGuid( "ClaimListAccessTest\$claim-$i" ); - } - - /** - * @var ClaimListAccess $list - */ - foreach ( $lists as $list ) { - foreach ( $claims as $claim ) { - $argLists[] = array( clone $list, array( $claim ) ); - } - - $argLists[] = array( clone $list, $claims ); - } - - return $argLists; - } - - /** - * @dataProvider claimTestProvider - * - * @param ClaimListAccess $list - * @param array $claims - */ - public function testAllOfTheStuff( ClaimListAccess $list, array $claims ) { - foreach ( $claims as $claim ) { - $list->addClaim( $claim ); - $this->assertTrue( $list->hasClaim( $claim ) ); - - $list->removeClaim( $claim ); - $this->assertFalse( $list->hasClaim( $claim ) ); - } - } - -}