Conditions | 4 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
36 | 7 | public function validate($received, string $format, string $min): bool |
|
37 | { |
||
38 | 7 | $dateReceived = DateTime::createFromFormat($format, $received); |
|
39 | 7 | $dateMin = DateTime::createFromFormat($format, $min); |
|
40 | |||
41 | 7 | if (!($dateMin && $dateReceived)) { |
|
42 | 1 | return true; |
|
43 | } |
||
44 | |||
45 | 6 | $dateMin->setTime(0, 0, 0); |
|
46 | 6 | $dateReceived->setTime(0, 0, 0); |
|
47 | |||
48 | 6 | if ($dateMin->format('Ymd') <= $dateReceived->format('Ymd')) { |
|
49 | 3 | $this->date = $dateReceived; |
|
50 | 3 | return false; |
|
51 | } |
||
52 | |||
53 | 3 | return true; |
|
54 | } |
||
66 |