Total Complexity | 11 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
6 | class Date |
||
7 | { |
||
8 | private $start; |
||
9 | private $end; |
||
10 | private $format; |
||
11 | private $value; |
||
12 | private $year; |
||
13 | |||
14 | /** |
||
15 | * Constructor |
||
16 | * |
||
17 | */ |
||
18 | public function __construct($options, $value) |
||
19 | { |
||
20 | $this->start = $options->start ?? null; |
||
21 | $this->end = $options->end ?? null; |
||
22 | $this->format = $$options->format ?? 'd M Y'; |
||
23 | $this->value = $value; |
||
24 | $this->year = DateTime::createFromFormat($this->format, $this->value)->format('Y'); |
||
25 | } |
||
26 | |||
27 | public function isAdate() |
||
30 | } |
||
31 | |||
32 | public function isDateBetween($start = null, $end = null) |
||
33 | { |
||
34 | if (!$this->start || !$this->end) { |
||
35 | $this->start = $start; |
||
36 | $this->end = $end; |
||
37 | } |
||
38 | |||
39 | if ($this->year < $this->start || $this->year > $this->end) { |
||
40 | return false; |
||
41 | } |
||
42 | return true; |
||
43 | } |
||
44 | |||
45 | public function minimum($start = null) |
||
53 | } |
||
54 | |||
55 | public function maximum($end = null) |
||
65 |