Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| DateTimeLessThanEqual | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| evaluate | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
3 | |||
| 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 less than or equals 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 DateTimeLessThanEqual extends LessThanEqual |
| 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 | |
| 46 | // Set the default message |
| 47 | if (!$this->hasMessage()) { |
| 48 | $this->generateDefaultMessage(null, $this->getValue()); |
| 49 | } |
| 50 | |
| 51 | return parent::evaluate($input); |
| 52 | } |
| 53 | |
| 54 | } |