Completed
Pull Request — master (#8)
by steef
03:12
created

DevelopersDay::generate()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3.054

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 9
cts 11
cp 0.8182
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 12
nc 3
nop 0
crap 3.054
1
<?php
2
3
namespace Stefanius\SpecialDates\Dates;
4
5
use Stefanius\SpecialDates\SDK\AbstractSpecialDate;
6
7
class DevelopersDay extends AbstractSpecialDate
8
{
9 12
    protected function generate()
10
    {
11 12
        $this->description = 'Programmeursdag';
12
13 12
        if ($this->year >= 2002) {
14 3
            if ($this->year % 4 === 0) {
15
                $this->startDate = new \DateTime($this->year . '-09-12');
16
                $this->endDate = new \DateTime($this->year . '-09-12');
17
            } else {
18 3
                $this->startDate = new \DateTime($this->year . '-09-13');
19 3
                $this->endDate = new \DateTime($this->year . '-09-13');
20
            }
21
22 3
            $this->totalLength = 1;
23
        } else {
24 9
            $this->valid = false;
25
        }
26 12
    }
27
}
28