Completed
Pull Request — master (#30)
by
unknown
01:42
created

DateTime::validate()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 5
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
        return $date['error_count'] ? false : true;
17
    }
18
}