Completed
Pull Request — master (#6)
by steef
08:13
created

FathersDay::generate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 0
1
<?php
2
3
namespace Stefanius\SpecialDates\CommonDates;
4
5
use Stefanius\SpecialDates\SDK\AbstractSpecialDate;
6
7 View Code Duplication
class FathersDay 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
    protected function generate()
10
    {
11
        $this->description = 'Vaderdag';
12
13
        if ($this->year >= 1948) {
14
            $timestamp       = strtotime('third sunday', mktime(0, 0, 0, 6, 0, $this->year));
15
            $date = new \DateTime();
16
            $date->setTimestamp($timestamp);
17
18
            $this->setupDateTimeObjects($date);
19
        } else {
20
            $this->valid = false;
21
        }
22
    }
23
}
24