Completed
Push — master ( 0e8f56...28a10f )
by Alexpts
02:22
created

DateValidator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

1 Method

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