| @@ -20,12 +20,12 @@ discard block | ||
| 20 | 20 | /** @var int|null */ | 
| 21 | 21 | private $lastObservance; | 
| 22 | 22 | |
| 23 | - /** @var HolidayIteratorItemInterface */ | |
| 24 | - private $wrapped; | |
| 23 | + /** @var HolidayIteratorItemInterface */ | |
| 24 | + private $wrapped; | |
| 25 | 25 | |
| 26 | - public function __construct(HolidayIteratorItemInterface $wrapped, ?int $firstObservance, ?int $lastObservance) | |
| 26 | + public function __construct(HolidayIteratorItemInterface $wrapped, ?int $firstObservance, ?int $lastObservance) | |
| 27 | 27 |      { | 
| 28 | - $this->wrapped = $wrapped; | |
| 28 | + $this->wrapped = $wrapped; | |
| 29 | 29 | $this->firstObservance = $firstObservance; | 
| 30 | 30 | $this->lastObservance = $lastObservance; | 
| 31 | 31 | } | 
| @@ -39,22 +39,22 @@ discard block | ||
| 39 | 39 | return null === $this->lastObservance || $this->lastObservance >= $gregorianYear; | 
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | - public function dateMatches(DateTimeInterface $date): bool | |
| 43 | -	{ | |
| 44 | -		if (! $this->isWithinObservance((int) $date->format('Y'))) { | |
| 45 | - return false; | |
| 46 | - } | |
| 42 | + public function dateMatches(DateTimeInterface $date): bool | |
| 43 | +    { | |
| 44 | +        if (! $this->isWithinObservance((int) $date->format('Y'))) { | |
| 45 | + return false; | |
| 46 | + } | |
| 47 | 47 | |
| 48 | - return $this->wrapped->dateMatches($date); | |
| 49 | - } | |
| 48 | + return $this->wrapped->dateMatches($date); | |
| 49 | + } | |
| 50 | 50 | |
| 51 | - public function getName(): string | |
| 52 | -	{ | |
| 53 | - return $this->wrapped->getName(); | |
| 54 | - } | |
| 51 | + public function getName(): string | |
| 52 | +    { | |
| 53 | + return $this->wrapped->getName(); | |
| 54 | + } | |
| 55 | 55 | |
| 56 | - public function isHoliday(): bool | |
| 57 | -	{ | |
| 58 | - return $this->wrapped->isHoliday(); | |
| 59 | - } | |
| 56 | + public function isHoliday(): bool | |
| 57 | +    { | |
| 58 | + return $this->wrapped->isHoliday(); | |
| 59 | + } | |
| 60 | 60 | } | 
| @@ -78,7 +78,7 @@ | ||
| 78 | 78 | public function dateMatches(DateTimeInterface $date): bool | 
| 79 | 79 |      { | 
| 80 | 80 |          $year = (int) $date->format('Y'); | 
| 81 | - $weekday = $this->calendarDay->getWeekdayForGregorianYear($year); | |
| 81 | + $weekday = $this->calendarDay->getWeekdayForGregorianYear($year); | |
| 82 | 82 |          if (in_array($weekday, $this->forwardWhen, true)) { | 
| 83 | 83 | return $this->calendarDay->isFollowUpDay($date, $this->forwardTo); | 
| 84 | 84 | } | 
| @@ -59,7 +59,7 @@ | ||
| 59 | 59 |      { | 
| 60 | 60 |          $year = (int) $date->format('Y'); | 
| 61 | 61 | |
| 62 | - $easter = $this->getEaster($year); | |
| 62 | + $easter = $this->getEaster($year); | |
| 63 | 63 |          if ($this->offset < 0) { | 
| 64 | 64 |              $day = $easter->sub(new DateInterval('P' . $this->offset * -1 . 'D')); | 
| 65 | 65 |          } else { | 
| @@ -69,5 +69,5 @@ | ||
| 69 | 69 | self::JAPANESE, | 
| 70 | 70 | self::PERSIAN, | 
| 71 | 71 | ]); | 
| 72 | - } | |
| 72 | + } | |
| 73 | 73 | } | 
| @@ -16,16 +16,16 @@ | ||
| 16 | 16 | |
| 17 | 17 | class EasterFactory implements ItemFromDomElementCreator | 
| 18 | 18 |  { | 
| 19 | - public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface | |
| 20 | -	{ | |
| 21 | -		if ($element->nodeName !== 'easter') { | |
| 22 | - return null; | |
| 23 | - } | |
| 19 | + public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface | |
| 20 | +    { | |
| 21 | +        if ($element->nodeName !== 'easter') { | |
| 22 | + return null; | |
| 23 | + } | |
| 24 | 24 | |
| 25 | - return new Easter( | |
| 26 | - $element->textContent, | |
| 27 | -			$element->getAttribute('free') === "true", | |
| 28 | -			(int) $element->getAttribute('offset') | |
| 29 | - ); | |
| 30 | - } | |
| 25 | + return new Easter( | |
| 26 | + $element->textContent, | |
| 27 | +            $element->getAttribute('free') === "true", | |
| 28 | +            (int) $element->getAttribute('offset') | |
| 29 | + ); | |
| 30 | + } | |
| 31 | 31 | } | 
| @@ -18,30 +18,30 @@ | ||
| 18 | 18 | |
| 19 | 19 | class DateFactory implements ItemFromDomElementCreator | 
| 20 | 20 |  { | 
| 21 | - public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface | |
| 22 | -	{ | |
| 23 | -		if ($element->nodeName !== 'date') { | |
| 24 | - return null; | |
| 25 | - } | |
| 26 | - | |
| 27 | - $day = CalendarDayFactory::createCalendarDay( | |
| 28 | -			(int) $element->getAttribute('day'), | |
| 29 | -			(int) $element->getAttribute('month'), | |
| 30 | -			($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian') | |
| 31 | - ); | |
| 32 | - | |
| 33 | -		if ($element->hasAttribute('year')) { | |
| 34 | -			$day->setYear((int) $element->getAttribute('year')); | |
| 35 | - } | |
| 36 | - | |
| 37 | - return new Date( | |
| 38 | - $element->textContent, | |
| 21 | + public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface | |
| 22 | +    { | |
| 23 | +        if ($element->nodeName !== 'date') { | |
| 24 | + return null; | |
| 25 | + } | |
| 26 | + | |
| 27 | + $day = CalendarDayFactory::createCalendarDay( | |
| 28 | +            (int) $element->getAttribute('day'), | |
| 29 | +            (int) $element->getAttribute('month'), | |
| 30 | +            ($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian') | |
| 31 | + ); | |
| 32 | + | |
| 33 | +        if ($element->hasAttribute('year')) { | |
| 34 | +            $day->setYear((int) $element->getAttribute('year')); | |
| 35 | + } | |
| 36 | + | |
| 37 | + return new Date( | |
| 38 | + $element->textContent, | |
| 39 | 39 |              $element->getAttribute('free') === "true", | 
| 40 | - $day, | |
| 41 | -			$element->hasAttribute('forwardto') ? $element->getAttribute('forwardto') : '', | |
| 42 | -			$element->hasAttribute('forwardwhen') ? explode(' ', $element->getAttribute('forwardwhen')) : [], | |
| 43 | -			$element->hasAttribute('rewindto') ? $element->getAttribute('rewindto') : '', | |
| 44 | -			$element->hasAttribute('rewindwhen') ? explode(' ', $element->getAttribute('rewindwhen')) : [], | |
| 45 | - ); | |
| 46 | - } | |
| 40 | + $day, | |
| 41 | +            $element->hasAttribute('forwardto') ? $element->getAttribute('forwardto') : '', | |
| 42 | +            $element->hasAttribute('forwardwhen') ? explode(' ', $element->getAttribute('forwardwhen')) : [], | |
| 43 | +            $element->hasAttribute('rewindto') ? $element->getAttribute('rewindto') : '', | |
| 44 | +            $element->hasAttribute('rewindwhen') ? explode(' ', $element->getAttribute('rewindwhen')) : [], | |
| 45 | + ); | |
| 46 | + } | |
| 47 | 47 | } | 
| @@ -18,24 +18,24 @@ | ||
| 18 | 18 | |
| 19 | 19 | class DateFollowupFactory implements ItemFromDomElementCreator | 
| 20 | 20 |  { | 
| 21 | - public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface | |
| 22 | -	{ | |
| 23 | -		if ($element->nodeName !== 'dateFollowUp') { | |
| 24 | - return null; | |
| 25 | - } | |
| 21 | + public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface | |
| 22 | +    { | |
| 23 | +        if ($element->nodeName !== 'dateFollowUp') { | |
| 24 | + return null; | |
| 25 | + } | |
| 26 | 26 | |
| 27 | - $day = CalendarDayFactory::createCalendarDay( | |
| 28 | -			(int) $element->getAttribute('day'), | |
| 29 | -			(int) $element->getAttribute('month'), | |
| 30 | -			($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian') | |
| 31 | - ); | |
| 27 | + $day = CalendarDayFactory::createCalendarDay( | |
| 28 | +            (int) $element->getAttribute('day'), | |
| 29 | +            (int) $element->getAttribute('month'), | |
| 30 | +            ($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian') | |
| 31 | + ); | |
| 32 | 32 | |
| 33 | - return new DateFollowUp( | |
| 34 | - $element->textContent, | |
| 35 | -			$element->getAttribute('free') === "true", | |
| 36 | - $day, | |
| 37 | -			$element->getAttribute('followup'), | |
| 38 | -			($element->hasAttribute('replaced') ? explode(' ', $element->getAttribute('replaced')) : []) | |
| 39 | - ); | |
| 40 | - } | |
| 33 | + return new DateFollowUp( | |
| 34 | + $element->textContent, | |
| 35 | +            $element->getAttribute('free') === "true", | |
| 36 | + $day, | |
| 37 | +            $element->getAttribute('followup'), | |
| 38 | +            ($element->hasAttribute('replaced') ? explode(' ', $element->getAttribute('replaced')) : []) | |
| 39 | + ); | |
| 40 | + } | |
| 41 | 41 | } | 
| @@ -16,16 +16,16 @@ | ||
| 16 | 16 | |
| 17 | 17 | class EasterOrthodoxFactory implements ItemFromDomElementCreator | 
| 18 | 18 |  { | 
| 19 | - public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface | |
| 20 | -	{ | |
| 21 | -		if ($element->nodeName !== 'easterorthodox') { | |
| 22 | - return null; | |
| 23 | - } | |
| 19 | + public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface | |
| 20 | +    { | |
| 21 | +        if ($element->nodeName !== 'easterorthodox') { | |
| 22 | + return null; | |
| 23 | + } | |
| 24 | 24 | |
| 25 | - return new EasterOrthodox( | |
| 26 | - $element->textContent, | |
| 25 | + return new EasterOrthodox( | |
| 26 | + $element->textContent, | |
| 27 | 27 |              $element->getAttribute('free') === "true", | 
| 28 | -			(int) $element->getAttribute('offset') | |
| 29 | - ); | |
| 30 | - } | |
| 28 | +            (int) $element->getAttribute('offset') | |
| 29 | + ); | |
| 30 | + } | |
| 31 | 31 | } | 
| @@ -15,5 +15,5 @@ | ||
| 15 | 15 | |
| 16 | 16 | interface ItemFromDomElementCreator | 
| 17 | 17 |  { | 
| 18 | - public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface; | |
| 18 | + public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface; | |
| 19 | 19 | } |