Test Failed
Branch develop (09cda0)
by Samson
03:06
created

LeapYearValidator::isValid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Andegna\Validator;
4
5
class LeapYearValidator implements Validator
6
{
7
    use ValidIntegerValidator;
8
9
    private $year;
10
11
    public function __construct($year)
12
    {
13
        $this->year = $year;
14
    }
15
16
    public function isValid()
17
    {
18
        return
19
            $this->isValidInteger($this->year) &&
20
            $this->isValidLeapYear($this->year);
21
    }
22
23
    protected function isValidLeapYear($year)
24
    {
25
        return ($year + 1) % 4 === 0;
26
    }
27
}
28