Conditions | 5 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public function isValid($input = null) |
||
24 | { |
||
25 | if ($input === null || $input === '') { |
||
26 | return false; |
||
27 | } |
||
28 | |||
29 | $input = (string) $input; |
||
30 | |||
31 | if (!preg_match(static::PATTERN, $input, $matches)) { |
||
32 | $this->violations[] = 'format'; |
||
33 | |||
34 | return false; |
||
35 | } |
||
36 | |||
37 | if (!checkdate($matches[2], $matches[3], $matches[1])) { |
||
38 | $this->violations[] = 'date'; |
||
39 | |||
40 | return false; |
||
41 | } |
||
42 | |||
43 | return true; |
||
44 | } |
||
46 |