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

PinkSaturday::generate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 8
CRAP Score 2.0054

Importance

Changes 0
Metric Value
dl 14
loc 14
ccs 8
cts 9
cp 0.8889
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 0
crap 2.0054
1
<?php
2
3
namespace Stefanius\SpecialDates\Dates;
4
5
use Stefanius\SpecialDates\SDK\AbstractSpecialDate;
6
7 View Code Duplication
class PinkSaturday 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 = 'Roze Zaterdag';
12
13 3
        if ($this->year >= 1977) {
14 3
            $timestamp       = strtotime('fourth saturday', mktime(0, 0, 0, 6, 0, $this->year));
15 3
            $date = new \DateTime();
16 3
            $date->setTimestamp($timestamp);
17
18 3
            $this->setupDateTimeObjects($date);
19
        } else {
20
            $this->valid = false;
21
        }
22 3
    }
23
}
24