Year   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 3
1
<?php
2
3
namespace Mbright\Validation\Rule\Validate\MySql;
4
5
use Mbright\Validation\Rule\Validate\ValidateRuleInterface;
6
7
/**
8
 * Handles 4 digit years supported by mysql 8.0
9
 */
10
class Year implements ValidateRuleInterface
11
{
12 21
    public function __invoke($subject, string $field): bool
13
    {
14 21
        $value = $subject->$field;
15
16 21
        if (!is_int($value)) {
17 6
            return false;
18
        }
19
20 15
        return $value >= 1901 && $value <= 2155;
21
    }
22
}
23