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

DevelopersDay   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 21
ccs 9
cts 11
cp 0.8182
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A generate() 0 18 3
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