Conditions | 4 |
Paths | 4 |
Total Lines | 8 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 60 | public function isValid(ValueObject $data) |
|
13 | { |
||
14 | 60 | if( ! is_string($data->value()) ) return false; |
|
15 | 54 | if(isset($this->options[0])){ |
|
16 | 11 | $dateObj = DateTime::createFromFormat($this->options[0], $data->value()); |
|
17 | 11 | return $dateObj && $dateObj->format($this->options[0]) === $data->value(); |
|
18 | } |
||
19 | 43 | return strtotime($data->value()) > 0; |
|
20 | } |
||
34 | } |