Total Complexity | 3 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
13 | class MaxDate implements ValidatorInterface |
||
14 | { |
||
15 | public static function validate($value, array $options = [], ?Model $model = null) |
||
16 | { |
||
17 | $max = $options['value']; |
||
18 | $val = Respect::date('Y-m-d'); |
||
19 | $val->max($max); |
||
20 | if (!$val->validate($value)) { |
||
21 | throw new ValidatorException('Value is too large.'); |
||
22 | } |
||
23 | |||
24 | return $value; |
||
25 | } |
||
26 | |||
27 | public static function getMetadata(): Metadata |
||
37 | ) |
||
38 | ] |
||
42 |