1 | <?php |
||
48 | class Selector implements SelectorInterface |
||
49 | { |
||
50 | /** |
||
51 | * Year component |
||
52 | * |
||
53 | * @var int |
||
54 | */ |
||
55 | protected $year = null; |
||
56 | /** |
||
57 | * Month component |
||
58 | * |
||
59 | * @var int |
||
60 | */ |
||
61 | protected $month = null; |
||
62 | /** |
||
63 | * Day component |
||
64 | * |
||
65 | * @var int |
||
66 | */ |
||
67 | protected $day = null; |
||
68 | /** |
||
69 | * Hour component |
||
70 | * |
||
71 | * @var int |
||
72 | */ |
||
73 | protected $hour = null; |
||
74 | /** |
||
75 | * Minute component |
||
76 | * |
||
77 | * @var int |
||
78 | */ |
||
79 | protected $minute = null; |
||
80 | /** |
||
81 | * Second component |
||
82 | * |
||
83 | * @var int |
||
84 | */ |
||
85 | protected $second = null; |
||
86 | /** |
||
87 | * Object ID |
||
88 | * |
||
89 | * @var int|string |
||
90 | */ |
||
91 | protected $uid = null; |
||
92 | /** |
||
93 | * Object type |
||
94 | * |
||
95 | * @var string |
||
96 | */ |
||
97 | protected $type = null; |
||
98 | /** |
||
99 | * Revision component |
||
100 | * |
||
101 | * @var int |
||
102 | */ |
||
103 | protected $revision = null; |
||
104 | /** |
||
105 | * Object visibility |
||
106 | * |
||
107 | * @var int |
||
108 | */ |
||
109 | protected $visibility = SelectorInterface::VISIBLE; |
||
110 | /** |
||
111 | * Object draft |
||
112 | * |
||
113 | * @var int |
||
114 | */ |
||
115 | protected $draft = SelectorInterface::PUBLISHED; |
||
116 | |||
117 | /** |
||
118 | * Repository selector constructor |
||
119 | * |
||
120 | * @param TypeServiceInterface $typeService Type Service |
||
121 | * @param string|int|NULL $year Year |
||
122 | * @param string|int|NULL $month Month |
||
123 | * @param string|int|NULL $day Day |
||
124 | * @param string|int|NULL $hour Hour |
||
125 | * @param string|int|NULL $minute Minute |
||
126 | * @param string|int|NULL $second Second |
||
127 | * @param string|int|NULL $uid Object ID |
||
128 | * @param string|NULL $type Object type |
||
129 | * @param int|NULL $revision Revision |
||
130 | * @param int $visibility Visibility |
||
131 | * @param int $draft Draft state |
||
132 | */ |
||
133 | 47 | public function __construct( |
|
165 | |||
166 | /** |
||
167 | * Validate the date component |
||
168 | * |
||
169 | * @param string|int|NULL $year Year |
||
170 | * @param string|int|NULL $month Month |
||
171 | * @param string|int|NULL $day Day |
||
172 | * @param string|int|NULL $hour Hour |
||
173 | * @param string|int|NULL $minute Minute |
||
174 | * @param string|int|NULL $second Second |
||
175 | * @throws InvalidArgumentException If any of the date components isn't valid |
||
176 | */ |
||
177 | 47 | protected function validateDateComponent( |
|
215 | |||
216 | /** |
||
217 | * Validate the ID component |
||
218 | * |
||
219 | * @param string|int|NULL $uid Object ID |
||
220 | * @throws InvalidArgumentException If the ID component isn't valid |
||
221 | */ |
||
222 | 46 | protected function validateIdComponent($uid) |
|
238 | |||
239 | /** |
||
240 | * Validate the type component |
||
241 | * |
||
242 | * @param TypeServiceInterface $typeService Type Service |
||
243 | * @param string|NULL $type Object type |
||
244 | * @throws InvalidArgumentException If the type component isn't valid |
||
245 | */ |
||
246 | 45 | protected function validateTypeComponent(TypeServiceInterface $typeService, $type) |
|
262 | |||
263 | /** |
||
264 | * Validate the revision component |
||
265 | * |
||
266 | * @param int|NULL $revision Revision |
||
267 | * @throws InvalidArgumentException If the revision component isn't valid |
||
268 | */ |
||
269 | 44 | protected function validateRevisionComponent($revision) |
|
285 | |||
286 | /** |
||
287 | * Validate the visibility component |
||
288 | * |
||
289 | * @param int $visibility Visibility |
||
290 | * @throws InvalidArgumentException If the visibility component isn't valid |
||
291 | */ |
||
292 | 43 | protected function validateVisibilityComponent($visibility) |
|
308 | |||
309 | /** |
||
310 | * Test if the given argument is a valid object visibility |
||
311 | * |
||
312 | * @param int $visibility Object visibility |
||
313 | * @return boolean Valid visibility |
||
314 | */ |
||
315 | 79 | public static function isValidVisibility($visibility) |
|
321 | |||
322 | /** |
||
323 | * Validate the draft component |
||
324 | * |
||
325 | * @param int $draft Draft state |
||
326 | * @throws InvalidArgumentException If the draft component isn't valid |
||
327 | */ |
||
328 | 42 | protected function validateDraftComponent($draft) |
|
344 | |||
345 | /** |
||
346 | * Test if the given argument is a valid object draft state |
||
347 | * |
||
348 | * @param int $draft Object draft state |
||
349 | * @return boolean Valid draft state |
||
350 | */ |
||
351 | 42 | public static function isValidDraftState($draft) |
|
357 | |||
358 | /** |
||
359 | * Return the year component |
||
360 | * |
||
361 | * @return int Year component |
||
362 | */ |
||
363 | 41 | public function getYear() |
|
367 | |||
368 | /** |
||
369 | * Return the month component |
||
370 | * |
||
371 | * @return int Month component |
||
372 | */ |
||
373 | 41 | public function getMonth() |
|
377 | |||
378 | /** |
||
379 | * Return the day component |
||
380 | * |
||
381 | * @return int Day component |
||
382 | */ |
||
383 | 41 | public function getDay() |
|
387 | |||
388 | /** |
||
389 | * Return the hour component |
||
390 | * |
||
391 | * @return int Hour component |
||
392 | */ |
||
393 | 8 | public function getHour() |
|
397 | |||
398 | /** |
||
399 | * Return the minute component |
||
400 | * |
||
401 | * @return int |
||
402 | */ |
||
403 | 8 | public function getMinute() |
|
407 | |||
408 | /** |
||
409 | * Return the second component |
||
410 | * |
||
411 | * @return int |
||
412 | */ |
||
413 | 8 | public function getSecond() |
|
417 | |||
418 | /** |
||
419 | * Return the ID component |
||
420 | * |
||
421 | * @return int ID component |
||
422 | */ |
||
423 | 41 | public function getId() |
|
427 | |||
428 | /** |
||
429 | * Return the Type component |
||
430 | * |
||
431 | * @return string |
||
432 | */ |
||
433 | 41 | public function getType() |
|
437 | |||
438 | /** |
||
439 | * Return the revision component |
||
440 | * |
||
441 | * @return int Revision component |
||
442 | */ |
||
443 | 41 | public function getRevision() |
|
447 | |||
448 | /** |
||
449 | * Return the object visibility |
||
450 | * |
||
451 | * @return int Object visibility |
||
452 | */ |
||
453 | 41 | public function getVisibility() |
|
457 | |||
458 | /** |
||
459 | * Return the object draft state |
||
460 | * |
||
461 | * @return int Object draft state |
||
462 | */ |
||
463 | 33 | public function getDraft() |
|
467 | } |
||
468 |