Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
DateTimeBetween | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
5 | |
100.00% |
1 / 1 |
evaluate | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
5 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@noladev.com> |
7 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Validator; |
15 | |
16 | /** |
17 | * Date-time between validator class |
18 | * |
19 | * @category Pop |
20 | * @package Pop\Validator |
21 | * @author Nick Sagona, III <dev@noladev.com> |
22 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. |
23 | * @license http://www.popphp.org/license New BSD License |
24 | * @version 4.5.0 |
25 | */ |
26 | class DateTimeBetween extends Between |
27 | { |
28 | |
29 | /** |
30 | * Traits |
31 | */ |
32 | use DateTimeTrait; |
33 | |
34 | /** |
35 | * Method to evaluate the validator |
36 | * |
37 | * @param mixed $input |
38 | * @return bool |
39 | */ |
40 | public function evaluate(mixed $input = null): bool |
41 | { |
42 | if ($input !== null) { |
43 | $input = strtotime($input); |
44 | } |
45 | if ($this->value !== null) { |
46 | $values = $this->getValue(); |
47 | if (is_array($values) && (count($values) == 2)) { |
48 | $this->message = 'The value must be between ' . $values[0] . ' and ' . $values[1] . '.'; |
49 | } |
50 | } |
51 | return parent::evaluate($input); |
52 | } |
53 | |
54 | } |