Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
66.67% covered (warning)
66.67%
2 / 3
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
DateTime
66.67% covered (warning)
66.67%
2 / 3
0.00% covered (danger)
0.00%
0 / 1
2.15
0.00% covered (danger)
0.00%
0 / 1
 isValid
66.67% covered (warning)
66.67%
2 / 3
0.00% covered (danger)
0.00%
0 / 1
2.15
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   phpOMS\Validation\Base
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace phpOMS\Validation\Base;
16
17use phpOMS\Validation\ValidatorAbstract;
18
19/**
20 * Validate date.
21 *
22 * @package phpOMS\Validation\Base
23 * @license OMS License 2.0
24 * @link    https://jingga.app
25 * @since   1.0.0
26 */
27abstract class DateTime extends ValidatorAbstract
28{
29    /**
30     * {@inheritdoc}
31     */
32    public static function isValid(mixed $value, array $constraints = null) : bool
33    {
34        if (!\is_string($value)) {
35            return false;
36        }
37
38        return (bool) \strtotime($value);
39    }
40}