DateTime::validate()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Linio\Component\Input\Constraint;
6
7
class DateTime extends Constraint
8
{
9
    public function validate($content): bool
10
    {
11
        if (!is_string($content)) {
12
            return false;
13
        }
14
15
        $date = date_parse($content);
16
17
        return $date['error_count'] ? false : true;
18
    }
19
}
20