1 | <?php |
||
8 | class DateValidator implements ValidatorInterface |
||
9 | { |
||
10 | use ValidIntegerValidator; |
||
11 | |||
12 | const FIRST_DAY = 1; |
||
13 | |||
14 | const FIRST_MONTH = self::FIRST_DAY; |
||
15 | |||
16 | const LAST_DAY = 30; |
||
17 | |||
18 | const LAST_MONTH = 13; |
||
19 | |||
20 | const PAGUME_LAST_DAY = 5; |
||
21 | |||
22 | const PAGUME_LEAP_YEAR_LAST_DAY = 6; |
||
23 | |||
24 | /** @var int */ |
||
25 | protected $day; |
||
26 | |||
27 | /** @var int */ |
||
28 | protected $month; |
||
29 | |||
30 | /** @var int */ |
||
31 | protected $year; |
||
32 | |||
33 | /** |
||
34 | * DateValidator constructor. |
||
35 | * |
||
36 | * @param $day int |
||
37 | * @param $month int |
||
38 | * @param $year int |
||
39 | */ |
||
40 | 141 | public function __construct($day, $month, $year) |
|
46 | |||
47 | /** |
||
48 | * validate the ethiopian date. |
||
49 | * |
||
50 | * @return bool true if valid |
||
51 | */ |
||
52 | 141 | public function isValid() |
|
66 | |||
67 | /** |
||
68 | * @return bool |
||
69 | */ |
||
70 | 135 | protected function isValidDayRange() |
|
75 | |||
76 | /** |
||
77 | * @return bool |
||
78 | */ |
||
79 | 123 | protected function isValidMonthRange() |
|
84 | |||
85 | /** |
||
86 | * @return bool |
||
87 | */ |
||
88 | 115 | protected function isValidPagumeDayRange() |
|
96 | |||
97 | /** |
||
98 | * @return bool |
||
99 | */ |
||
100 | 111 | protected function isValidLeapDay() |
|
110 | |||
111 | /** |
||
112 | * @return bool |
||
113 | */ |
||
114 | 141 | protected function isDateValuesIntegers() |
|
118 | } |
||
119 |