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

DateTime   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 9 3
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
}