Total Complexity | 3 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
12 | class MinDatetime implements ValidatorInterface |
||
13 | { |
||
14 | public static function validate($value, array $options = [], ?Model $model = null) |
||
15 | { |
||
16 | $min = $options['value']; |
||
17 | // TODO: now |
||
18 | $dt = \DateTime::createFromFormat(\DateTime::ISO8601, $value); |
||
19 | $min = \DateTime::createFromFormat(\DateTime::ISO8601, $min); |
||
20 | if ($dt < $min) { |
||
21 | throw new ValidatorException('Value is too small.'); |
||
22 | } |
||
23 | |||
24 | return $value; |
||
25 | } |
||
26 | |||
27 | public static function getMetadata(): Metadata |
||
37 | ) |
||
38 | ] |
||
42 |