Skip to content

Commit cfd61e4

Browse files
committed
Merge pull request #388 from wmde/dupeCode
Move implementations from Claim to Statement
2 parents d532c09 + 9461a0e commit cfd61e4

1 file changed

Lines changed: 89 additions & 4 deletions

File tree

src/Statement/Statement.php

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ class Statement extends Claim {
3131
const RANK_NORMAL = 1;
3232
const RANK_DEPRECATED = 0;
3333

34+
/**
35+
* @var string|null
36+
*/
37+
protected $guid = null;
38+
39+
/**
40+
* @var Snak
41+
*/
42+
protected $mainSnak;
43+
44+
/**
45+
* The property value snaks making up the qualifiers for this statement.
46+
*
47+
* @var Snaks
48+
*/
49+
protected $qualifiers;
50+
3451
/**
3552
* @var ReferenceList
3653
*/
@@ -58,6 +75,78 @@ public function __construct(
5875
$this->references = $references ?: new ReferenceList();
5976
}
6077

78+
/**
79+
* Returns the GUID of this statement.
80+
*
81+
* @since 0.2
82+
*
83+
* @return string|null
84+
*/
85+
public function getGuid() {
86+
return $this->guid;
87+
}
88+
89+
/**
90+
* Sets the GUID of this statement.
91+
*
92+
* @since 0.2
93+
*
94+
* @param string|null $guid
95+
*
96+
* @throws InvalidArgumentException
97+
*/
98+
public function setGuid( $guid ) {
99+
if ( !is_string( $guid ) && $guid !== null ) {
100+
throw new InvalidArgumentException( '$guid must be a string or null' );
101+
}
102+
103+
$this->guid = $guid;
104+
}
105+
106+
/**
107+
* Returns the main value snak of this statement.
108+
*
109+
* @since 0.1
110+
*
111+
* @return Snak
112+
*/
113+
public function getMainSnak() {
114+
return $this->mainSnak;
115+
}
116+
117+
/**
118+
* Sets the main value snak of this statement.
119+
*
120+
* @since 0.1
121+
*
122+
* @param Snak $mainSnak
123+
*/
124+
public function setMainSnak( Snak $mainSnak ) {
125+
$this->mainSnak = $mainSnak;
126+
}
127+
128+
/**
129+
* Returns the property value snaks making up the qualifiers for this statement.
130+
*
131+
* @since 0.1
132+
*
133+
* @return Snaks
134+
*/
135+
public function getQualifiers() {
136+
return $this->qualifiers;
137+
}
138+
139+
/**
140+
* Sets the property value snaks making up the qualifiers for this statement.
141+
*
142+
* @since 0.1
143+
*
144+
* @param Snaks $propertySnaks
145+
*/
146+
public function setQualifiers( Snaks $propertySnaks ) {
147+
$this->qualifiers = $propertySnaks;
148+
}
149+
61150
/**
62151
* Returns the references attached to this statement.
63152
*
@@ -114,8 +203,6 @@ public function setRank( $rank ) {
114203
}
115204

116205
/**
117-
* @see Claim::getRank
118-
*
119206
* @since 0.1
120207
*
121208
* @return integer
@@ -143,8 +230,6 @@ public function getHash() {
143230
}
144231

145232
/**
146-
* @see Claim::getAllSnaks.
147-
*
148233
* In addition to the Snaks returned by Claim::getAllSnaks(), this also includes all
149234
* snaks from any References in this Statement.
150235
*

0 commit comments

Comments
 (0)