Total Complexity | 9 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | final class ObservanceDecorator implements HolidayIteratorItemInterface |
||
16 | { |
||
17 | /** @var int|null */ |
||
18 | private $firstObservance; |
||
19 | |||
20 | /** @var int|null */ |
||
21 | private $lastObservance; |
||
22 | |||
23 | /** @var HolidayIteratorItemInterface */ |
||
24 | private $wrapped; |
||
25 | |||
26 | public function __construct(HolidayIteratorItemInterface $wrapped, ?int $firstObservance, ?int $lastObservance) |
||
27 | { |
||
28 | $this->wrapped = $wrapped; |
||
29 | $this->firstObservance = $firstObservance; |
||
30 | $this->lastObservance = $lastObservance; |
||
31 | } |
||
32 | |||
33 | private function isWithinObservance(int $gregorianYear): bool |
||
40 | } |
||
41 | |||
42 | public function dateMatches(DateTimeInterface $date): bool |
||
43 | { |
||
44 | if (! $this->isWithinObservance((int) $date->format('Y'))) { |
||
45 | return false; |
||
46 | } |
||
47 | |||
48 | return $this->wrapped->dateMatches($date); |
||
49 | } |
||
50 | |||
51 | public function getName(): string |
||
54 | } |
||
55 | |||
56 | public function isHoliday(): bool |
||
59 | } |
||
60 | } |
||
61 |