1 | <?php |
||
55 | class SystemProperties extends AbstractProperties |
||
56 | { |
||
57 | /** |
||
58 | * Collection name |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | const COLLECTION = 'system'; |
||
63 | /** |
||
64 | * ID property |
||
65 | * |
||
66 | * @var string |
||
67 | */ |
||
68 | const PROPERTY_ID = 'id'; |
||
69 | /** |
||
70 | * Type property |
||
71 | * |
||
72 | * @var string |
||
73 | */ |
||
74 | const PROPERTY_TYPE = 'type'; |
||
75 | /** |
||
76 | * Revision property |
||
77 | * |
||
78 | * @var string |
||
79 | */ |
||
80 | const PROPERTY_REVISION = 'revision'; |
||
81 | /** |
||
82 | * Created property |
||
83 | * |
||
84 | * @var string |
||
85 | */ |
||
86 | const PROPERTY_CREATED = 'created'; |
||
87 | /** |
||
88 | * Published property |
||
89 | * |
||
90 | * @var string |
||
91 | */ |
||
92 | const PROPERTY_PUBLISHED = 'published'; |
||
93 | /** |
||
94 | * LocationProperties property |
||
95 | * |
||
96 | * @var string |
||
97 | */ |
||
98 | const PROPERTY_LOCATION = 'location'; |
||
99 | /** |
||
100 | * Object ID (constant throughout revisions) |
||
101 | * |
||
102 | * @var Id |
||
103 | */ |
||
104 | protected $uid = null; |
||
105 | /** |
||
106 | * Object type (constant throughout revisions) |
||
107 | * |
||
108 | * @var Type |
||
109 | */ |
||
110 | protected $type = null; |
||
111 | /** |
||
112 | * Object revision |
||
113 | * |
||
114 | * @var Revision |
||
115 | */ |
||
116 | protected $revision = null; |
||
117 | /** |
||
118 | * Creation date of this revision |
||
119 | * |
||
120 | * @var \DateTimeImmutable |
||
121 | */ |
||
122 | protected $created = null; |
||
123 | /** |
||
124 | * Publication date of this revision |
||
125 | * |
||
126 | * @var \DateTimeImmutable |
||
127 | */ |
||
128 | protected $published = null; |
||
129 | /** |
||
130 | * Location |
||
131 | * |
||
132 | * @var LocationProperties |
||
133 | */ |
||
134 | protected $location = null; |
||
135 | |||
136 | /** |
||
137 | * System properties constructor |
||
138 | * |
||
139 | * @param array $data Property data |
||
140 | * @param ObjectInterface $object Owner object |
||
141 | */ |
||
142 | 27 | public function __construct(array $data, ObjectInterface $object) |
|
189 | |||
190 | /** |
||
191 | * Return the object ID |
||
192 | * |
||
193 | * @return Id Object ID |
||
194 | */ |
||
195 | 5 | public function getId() |
|
199 | |||
200 | /** |
||
201 | * Return the object type |
||
202 | * |
||
203 | * @return Type Object type |
||
204 | */ |
||
205 | 1 | public function getType() |
|
209 | |||
210 | /** |
||
211 | * Return the object revision |
||
212 | * |
||
213 | * @return Revision Object revision |
||
214 | */ |
||
215 | 24 | public function getRevision() |
|
219 | |||
220 | /** |
||
221 | * Return the object draft mode |
||
222 | * |
||
223 | * @return boolean Object draft mode |
||
224 | */ |
||
225 | 5 | public function isDraft() |
|
229 | |||
230 | /** |
||
231 | * Return the creation date & time of this revision |
||
232 | * |
||
233 | * @return \DateTimeImmutable Creation date & time |
||
234 | */ |
||
235 | 1 | public function getCreated() |
|
239 | |||
240 | /** |
||
241 | * Return the publication date & time of this revision |
||
242 | * |
||
243 | * @return \DateTimeImmutable|null Publication date & time |
||
244 | */ |
||
245 | 1 | public function getPublished() |
|
249 | |||
250 | /** |
||
251 | * Return the latitude |
||
252 | * |
||
253 | * @return float Latitude |
||
254 | */ |
||
255 | 1 | public function getLatitude() |
|
259 | |||
260 | /** |
||
261 | * Set the latitude |
||
262 | * |
||
263 | * @param float $latitude Latitude |
||
264 | * @return SystemProperties Self reference |
||
265 | */ |
||
266 | 1 | public function setLatitude($latitude) |
|
273 | |||
274 | /** |
||
275 | * Return the longitude |
||
276 | * |
||
277 | * @return float Longitude |
||
278 | */ |
||
279 | 1 | public function getLongitude() |
|
283 | |||
284 | /** |
||
285 | * Set the longitude |
||
286 | * |
||
287 | * @param float $longitude Longitude |
||
288 | * @return SystemProperties Self reference |
||
289 | */ |
||
290 | 1 | public function setLongitude($longitude) |
|
297 | |||
298 | /** |
||
299 | * Return the elevation |
||
300 | * |
||
301 | * @return float Elevation |
||
302 | */ |
||
303 | 1 | public function getElevation() |
|
307 | |||
308 | /** |
||
309 | * Set the elevation |
||
310 | * |
||
311 | * @param float $elevation |
||
312 | * @return SystemProperties Self reference |
||
313 | */ |
||
314 | 1 | public function setElevation($elevation) |
|
321 | |||
322 | /** |
||
323 | * Derive draft system properties |
||
324 | * |
||
325 | * @param Revision $draftRevision Draft revision |
||
326 | * @return SystemProperties Draft system properties |
||
327 | */ |
||
328 | 4 | public function createDraft(Revision $draftRevision) |
|
340 | |||
341 | /** |
||
342 | * Indicate that the object got published |
||
343 | * |
||
344 | * @return SystemProperties System properties |
||
345 | * @throws RuntimeException If the object is already published |
||
346 | */ |
||
347 | 2 | public function publish() |
|
361 | |||
362 | /** |
||
363 | * Return the property values as array |
||
364 | * |
||
365 | * @return array Property values |
||
366 | */ |
||
367 | 5 | public function toArray() |
|
379 | } |
||
380 |