Code Duplication    Length = 19-21 lines in 2 locations

src/Stefanius/SpecialDates/Dates/DayOfConstruction.php 1 location

@@ 7-27 (lines=21) @@
4
5
use Stefanius\SpecialDates\SDK\AbstractSpecialDate;
6
7
class DayOfConstruction extends AbstractSpecialDate
8
{
9
    protected function generate()
10
    {
11
        $this->description = 'Dag van de Bouw';
12
13
        if ($this->year >= 2009) {
14
            $this->setupDateTimeObjects($this->generateDateTime($this->year, 6, 6));
15
        } else if ($this->year >= 2011) {
16
            $this->setupDateTimeObjects($this->generateDateTime($this->year, 5, 28));
17
        } else if ($this->year >= 2009) {
18
            $timestamp       = strtotime('first saturday', mktime(0, 0, 0, 6, 0, $this->year));
19
            $date = new \DateTime();
20
            $date->setTimestamp($timestamp);
21
22
            $this->setupDateTimeObjects($date);
23
        } else {
24
            $this->valid = false;
25
        }
26
    }
27
}
28

src/Stefanius/SpecialDates/Dates/DutchVeteransDay.php 1 location

@@ 7-25 (lines=19) @@
4
5
use Stefanius\SpecialDates\SDK\AbstractSpecialDate;
6
7
class DutchVeteransDay extends AbstractSpecialDate
8
{
9
    protected function generate()
10
    {
11
        $this->description = 'Nederlandse Veteranendag';
12
13
        if ($this->year === 2008) {
14
            $this->setupDateTimeObjects($this->generateDateTime($this->year, 6, 28));
15
        } else if ($this->year >= 2005 && $this->year < 2009) {
16
            $this->setupDateTimeObjects($this->generateDateTime($this->year, 6, 29));
17
        } 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
    }
25
}
26