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

FathersDay::generate()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3.0416

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 16
ccs 10
cts 12
cp 0.8333
rs 9.4285
cc 3
eloc 11
nc 3
nop 0
crap 3.0416
1
<?php
2
3
namespace Stefanius\SpecialDates\Dates;
4
5
use Stefanius\SpecialDates\SDK\AbstractSpecialDate;
6
7
class FathersDay extends AbstractSpecialDate
8
{
9 3
    protected function generate()
10
    {
11 3
        $this->description = 'Vaderdag';
12
13 3
        if ($this->year >= 2009) {
14
            $this->setupDateTimeObjects($this->generateDateTime($this->year, 6, 19));
15 3
        } else if ($this->year >= 1909) {
16 3
            $timestamp       = strtotime('third sunday', mktime(0, 0, 0, 6, 0, $this->year));
17 3
            $date = new \DateTime();
18 3
            $date->setTimestamp($timestamp);
19
20 3
            $this->setupDateTimeObjects($date);
21 3
        } else {
22
            $this->valid = false;
23
        }
24 3
    }
25
}
26