DateValidator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 4
1
<?php
2
namespace PTS\Validator\Validators;
3
4
class DateValidator
5
{
6 6
    public function __invoke($value): bool
7
    {
8 6
        if ((!\is_string($value) && !\is_numeric($value)) || strtotime($value) === false) {
9 1
            return false;
10
        }
11
        
12 5
        $date = date_parse($value);
13 5
        return checkdate($date['month'], $date['day'], $date['year']);
14
    }
15
}
16