Addshore has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72632


Change subject: Adding checks for Rank and PropertyId
......................................................................

Adding checks for Rank and PropertyId

Change-Id: Ief4d718fe0769c0d1806dd70d21e4a63f0430ee9
---
M DataModel/Claim/Claim.php
1 file changed, 25 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseDataModel 
refs/changes/32/72632/1

diff --git a/DataModel/Claim/Claim.php b/DataModel/Claim/Claim.php
index 2507923..1ce2335 100644
--- a/DataModel/Claim/Claim.php
+++ b/DataModel/Claim/Claim.php
@@ -3,6 +3,8 @@
 namespace Wikibase;
 
 use InvalidArgumentException;
+use Wikibase\Lib\Serializers\ClaimSerializer;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Class that represents a single Wikibase claim.
@@ -239,6 +241,29 @@
                $this->setGuid( $instance->getGuid() );
        }
 
+       /**
+        * Returns bool showing if claim has $rank
+        *
+        * @param $rank
+        * @return bool
+        */
+       public function hasRank($rank){
+               $rank = isset( $rank ) ? ClaimSerializer::unserializeRank( 
$rank ) : false;
+               return $this->getRank()->equals( $rank );
+       }
+
+       /**
+        * Returns bool showing if claim has $propertyId
+        *
+        * @param $propertyId
+        * @return bool
+        */
+       public function hasPropertyId($propertyId){
+               /** @var EntityId $propertyId */
+               $propertyId = 
WikibaseRepo::getDefaultInstance()->getEntityIdParser()->parse( $propertyId );
+               return $this->getPropertyId()->equals( $propertyId );
+       }
+
 }
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/72632
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief4d718fe0769c0d1806dd70d21e4a63f0430ee9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseDataModel
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to