1 | <?php |
||
20 | class Property implements EntityDocument, FingerprintHolder, StatementListHolder { |
||
21 | |||
22 | const ENTITY_TYPE = 'property'; |
||
23 | |||
24 | /** |
||
25 | * @var PropertyId|null |
||
26 | */ |
||
27 | private $id; |
||
28 | |||
29 | /** |
||
30 | * @var Fingerprint |
||
31 | */ |
||
32 | private $fingerprint; |
||
33 | |||
34 | /** |
||
35 | * @var string The data type of the property. |
||
36 | */ |
||
37 | private $dataTypeId; |
||
38 | |||
39 | /** |
||
40 | * @var StatementList |
||
41 | */ |
||
42 | private $statements; |
||
43 | |||
44 | /** |
||
45 | * @since 1.0 |
||
46 | * |
||
47 | * @param PropertyId|null $id |
||
48 | * @param Fingerprint|null $fingerprint |
||
49 | * @param string $dataTypeId The data type of the property. Not to be confused with the data |
||
50 | * value type. |
||
51 | * @param StatementList|null $statements Since 1.1 |
||
52 | */ |
||
53 | 69 | public function __construct( |
|
64 | |||
65 | /** |
||
66 | * Returns the id of the entity or null if it does not have one. |
||
67 | * |
||
68 | * @since 0.1 return type changed in 0.3 |
||
69 | * |
||
70 | * @return PropertyId|null |
||
71 | */ |
||
72 | 13 | public function getId() { |
|
73 | 13 | return $this->id; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * Can be integer since 0.1. |
||
78 | * Can be PropertyId since 0.5. |
||
79 | * Can be null since 1.0. |
||
80 | * |
||
81 | * @param PropertyId|int|null $id |
||
82 | * |
||
83 | * @throws InvalidArgumentException |
||
84 | */ |
||
85 | 4 | public function setId( $id ) { |
|
95 | |||
96 | /** |
||
97 | * @since 0.7.3 |
||
98 | * |
||
99 | * @return Fingerprint |
||
100 | */ |
||
101 | 58 | public function getFingerprint() { |
|
102 | 58 | return $this->fingerprint; |
|
103 | } |
||
104 | |||
105 | /** |
||
106 | * @since 0.7.3 |
||
107 | * |
||
108 | * @param Fingerprint $fingerprint |
||
109 | */ |
||
110 | 3 | public function setFingerprint( Fingerprint $fingerprint ) { |
|
111 | 3 | $this->fingerprint = $fingerprint; |
|
112 | 3 | } |
|
113 | |||
114 | /** |
||
115 | * @param string $languageCode |
||
116 | * @param string $value |
||
117 | * |
||
118 | * @throws InvalidArgumentException |
||
119 | */ |
||
120 | 12 | public function setLabel( $languageCode, $value ) { |
|
123 | |||
124 | /** |
||
125 | * @param string $languageCode |
||
126 | * @param string $value |
||
127 | * |
||
128 | * @throws InvalidArgumentException |
||
129 | */ |
||
130 | 11 | public function setDescription( $languageCode, $value ) { |
|
133 | |||
134 | /** |
||
135 | * @param string $languageCode |
||
136 | * @param string[] $aliases |
||
137 | * |
||
138 | * @throws InvalidArgumentException |
||
139 | */ |
||
140 | 31 | public function setAliases( $languageCode, array $aliases ) { |
|
143 | |||
144 | /** |
||
145 | * @since 0.4 |
||
146 | * |
||
147 | * @param string $dataTypeId The data type of the property. Not to be confused with the data |
||
148 | * value type. |
||
149 | * |
||
150 | * @throws InvalidArgumentException |
||
151 | 69 | */ |
|
152 | 69 | public function setDataTypeId( $dataTypeId ) { |
|
159 | |||
160 | /** |
||
161 | * @since 0.4 |
||
162 | * |
||
163 | * @return string Returns the data type of the property (property type). Not to be confused with |
||
164 | 4 | * the data value type. |
|
165 | 4 | */ |
|
166 | public function getDataTypeId() { |
||
169 | |||
170 | /** |
||
171 | * @see Entity::getType |
||
172 | * |
||
173 | * @since 0.1 |
||
174 | * |
||
175 | * @return string Returns the entity type "property". |
||
176 | */ |
||
177 | public function getType() { |
||
180 | |||
181 | /** |
||
182 | * @since 0.3 |
||
183 | * |
||
184 | * @param string $dataTypeId The data type of the property. Not to be confused with the data |
||
185 | * value type. |
||
186 | 66 | * |
|
187 | 66 | * @return self |
|
188 | */ |
||
189 | public static function newFromType( $dataTypeId ) { |
||
192 | |||
193 | /** |
||
194 | * @see EntityDocument::equals |
||
195 | * |
||
196 | * @since 0.1 |
||
197 | * |
||
198 | * @param mixed $target |
||
199 | * |
||
200 | * @return bool |
||
201 | */ |
||
202 | public function equals( $target ) { |
||
212 | 18 | ||
213 | /** |
||
214 | * Returns if the Property has no content. |
||
215 | * Having an id and type set does not count as having content. |
||
216 | * |
||
217 | * @since 0.1 |
||
218 | * |
||
219 | * @return bool |
||
220 | */ |
||
221 | public function isEmpty() { |
||
225 | 4 | ||
226 | /** |
||
227 | * Removes all content from the Property. |
||
228 | * The id and the type are not part of the content. |
||
229 | * |
||
230 | * @since 0.1 |
||
231 | */ |
||
232 | public function clear() { |
||
236 | 1 | ||
237 | /** |
||
238 | * @since 1.1 |
||
239 | * |
||
240 | * @return StatementList |
||
241 | */ |
||
242 | public function getStatements() { |
||
245 | |||
246 | /** |
||
247 | * @since 1.1 |
||
248 | * |
||
249 | * @param StatementList $statements |
||
250 | */ |
||
251 | public function setStatements( StatementList $statements ) { |
||
254 | 2 | ||
255 | /** |
||
256 | * @see EntityDocument::copy |
||
257 | * |
||
258 | * @since 0.1 |
||
259 | * |
||
260 | * @return self |
||
261 | 4 | */ |
|
262 | 4 | public function copy() { |
|
265 | |||
266 | } |
||
267 |