Completed
Push — master ( 2dd332...d6426f )
by steef
02:53
created

DutchVeteransDay::generate()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 16
Code Lines 11

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 8.9038

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 16
loc 16
ccs 6
cts 13
cp 0.4615
rs 8.8571
cc 5
eloc 11
nc 4
nop 0
crap 8.9038
1
<?php
2
3
namespace Stefanius\SpecialDates\Dates;
4
5
use Stefanius\SpecialDates\SDK\AbstractSpecialDate;
6
7 View Code Duplication
class DutchVeteransDay extends AbstractSpecialDate
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9 3
    protected function generate()
10
    {
11 3
        $this->description = 'Nederlandse Veteranendag';
12
13 3
        if ($this->year === 2008) {
14
            $this->setupDateTimeObjects($this->generateDateTime($this->year, 6, 28));
15 3
        } else if ($this->year >= 2005 && $this->year < 2009) {
16
            $this->setupDateTimeObjects($this->generateDateTime($this->year, 6, 29));
17 3
        } else if ($this->year >= 2009) {
18
            $timestamp       = strtotime('last saturday', mktime(0, 0, 0, 6, 0, $this->year));
19
            $date = new \DateTime();
20
            $date->setTimestamp($timestamp);
21
22
            $this->setupDateTimeObjects($date);
23
        }
24 3
    }
25
}
26