From e08810465308e18ebdf0d6eb6728d880da8b5817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thiemo=20M=C3=A4ttig?= Date: Fri, 20 Feb 2015 15:49:46 +0100 Subject: [PATCH 1/2] Move implementations from Claim to Statement --- src/Statement/Statement.php | 99 +++++++++++++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 4 deletions(-) diff --git a/src/Statement/Statement.php b/src/Statement/Statement.php index 03c7f47c..b453c835 100644 --- a/src/Statement/Statement.php +++ b/src/Statement/Statement.php @@ -31,6 +31,29 @@ class Statement extends Claim { const RANK_NORMAL = 1; const RANK_DEPRECATED = 0; + /** + * @since 0.2 + * + * @var string|null + */ + private $guid = null; + + /** + * @since 0.1 + * + * @var Snak + */ + private $mainSnak; + + /** + * The property value snaks making up the qualifiers for this statement. + * + * @since 0.1 + * + * @var Snaks + */ + private $qualifiers; + /** * @var ReferenceList */ @@ -58,6 +81,78 @@ public function __construct( $this->references = $references ?: new ReferenceList(); } + /** + * Returns the GUID of this statement. + * + * @since 0.2 + * + * @return string|null + */ + public function getGuid() { + return $this->guid; + } + + /** + * Sets the GUID of this statement. + * + * @since 0.2 + * + * @param string|null $guid + * + * @throws InvalidArgumentException + */ + public function setGuid( $guid ) { + if ( !is_string( $guid ) && $guid !== null ) { + throw new InvalidArgumentException( '$guid must be a string or null' ); + } + + $this->guid = $guid; + } + + /** + * Returns the main value snak of this statement. + * + * @since 0.1 + * + * @return Snak + */ + public function getMainSnak() { + return $this->mainSnak; + } + + /** + * Sets the main value snak of this statement. + * + * @since 0.1 + * + * @param Snak $mainSnak + */ + public function setMainSnak( Snak $mainSnak ) { + $this->mainSnak = $mainSnak; + } + + /** + * Returns the property value snaks making up the qualifiers for this statement. + * + * @since 0.1 + * + * @return Snaks + */ + public function getQualifiers() { + return $this->qualifiers; + } + + /** + * Sets the property value snaks making up the qualifiers for this statement. + * + * @since 0.1 + * + * @param Snaks $propertySnaks + */ + public function setQualifiers( Snaks $propertySnaks ) { + $this->qualifiers = $propertySnaks; + } + /** * Returns the references attached to this statement. * @@ -114,8 +209,6 @@ public function setRank( $rank ) { } /** - * @see Claim::getRank - * * @since 0.1 * * @return integer @@ -143,8 +236,6 @@ public function getHash() { } /** - * @see Claim::getAllSnaks. - * * In addition to the Snaks returned by Claim::getAllSnaks(), this also includes all * snaks from any References in this Statement. * From 9461a0ebb3e9bcc67e742079dbdb27a39cba8d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thiemo=20M=C3=A4ttig?= Date: Mon, 23 Feb 2015 11:15:28 +0100 Subject: [PATCH 2/2] protected --- src/Statement/Statement.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Statement/Statement.php b/src/Statement/Statement.php index b453c835..58dcc366 100644 --- a/src/Statement/Statement.php +++ b/src/Statement/Statement.php @@ -32,27 +32,21 @@ class Statement extends Claim { const RANK_DEPRECATED = 0; /** - * @since 0.2 - * * @var string|null */ - private $guid = null; + protected $guid = null; /** - * @since 0.1 - * * @var Snak */ - private $mainSnak; + protected $mainSnak; /** * The property value snaks making up the qualifiers for this statement. * - * @since 0.1 - * * @var Snaks */ - private $qualifiers; + protected $qualifiers; /** * @var ReferenceList