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

LeapYearValidator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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