Completed
Push — main ( ed9382...1be441 )
by Andreas
14s queued 13s
created
src/CalendarDay.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -15,131 +15,131 @@
 block discarded – undo
15 15
 
16 16
 class CalendarDay
17 17
 {
18
-	/** @var int */
19
-	private $day;
20
-
21
-	/** @var int */
22
-	private $month;
23
-
24
-	/** @var int|null */
25
-	private $year = null;
26
-
27
-	/** @var IntlCalendar */
28
-	private $calendar;
29
-
30
-	public function __construct(int $day, int $month, IntlCalendar $calendar)
31
-	{
32
-		$this->day = $day;
33
-		$this->month = $month;
34
-		$this->calendar = $calendar;
35
-		$this->calendar->set(IntlCalendar::FIELD_DAY_OF_MONTH, $day);
36
-		$this->calendar->set(IntlCalendar::FIELD_MONTH, $month - 1);
37
-		$this->calendar->set(IntlCalendar::FIELD_HOUR_OF_DAY, 12);
38
-		$this->calendar->set(IntlCalendar::FIELD_MINUTE, 0);
39
-		$this->calendar->set(IntlCalendar::FIELD_SECOND, 0);
40
-		$this->calendar->set(IntlCalendar::FIELD_MILLISECOND, 0);
41
-	}
42
-
43
-	public function setYear(int $year): void
44
-	{
45
-		$this->year = $year;
46
-		$this->calendar->set(IntlCalendar::FIELD_YEAR, $year);
47
-	}
48
-
49
-	public function setGregorianYear(int $year): void
50
-	{
51
-		$calendarYear = (int) $this->calendar->toDateTime()->format('Y');
52
-
53
-		$diff = $year - $calendarYear;
54
-		$realYear = $this->calendar->get(IntlCalendar::FIELD_YEAR);
55
-
56
-		$this->year = $realYear + $diff;
57
-		$this->calendar->add(IntlCalendar::FIELD_YEAR, $diff);
58
-	}
59
-
60
-	public function isSameDay(DateTimeInterface $dateTime): bool
61
-	{
62
-		$cal = clone $this->calendar;
63
-		$cal->setTime($dateTime->getTimestamp() * 1000);
64
-
65
-		if (null !== $this->year &&
66
-			$cal->get(IntlCalendar::FIELD_YEAR) !== $this->calendar->get(IntlCalendar::FIELD_YEAR)
67
-		) {
68
-			return false;
69
-		}
70
-
71
-		if ($cal->get(IntlCalendar::FIELD_MONTH) !== $this->calendar->get(IntlCalendar::FIELD_MONTH)) {
72
-			return false;
73
-		}
74
-
75
-		return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $this->calendar->get(IntlCalendar::FIELD_DAY_OF_MONTH);
76
-	}
77
-
78
-	public function getCalendar(): IntlCalendar
79
-	{
80
-		return clone $this->calendar;
81
-	}
82
-
83
-	public function hasYearSet(): bool
84
-	{
85
-		return null !== $this->year;
86
-	}
87
-
88
-	public function isFollowUpDay(DateTimeInterface $dateTime, string $followUpDay): bool
89
-	{
90
-		return $this->isModifiedDate($dateTime, $followUpDay, 'next');
91
-	}
92
-
93
-	private function isModifiedDate(DateTimeInterface $dateTime, string $modifiedDay, string $direction): bool
94
-	{
95
-		$cal = clone $this->calendar;
96
-		$cal = self::setGregorianYearForDate((int) $dateTime->format('Y'), $cal);
97
-		$day = $cal->toDateTime();
98
-		$day->modify($direction . ' ' . $modifiedDay);
99
-		$cal->setTime($day->getTimestamp() * 1000);
100
-		$cal2 = clone $this->calendar;
101
-		$cal2->setTime($dateTime->getTimestamp() * 1000);
102
-
103
-		if (null !== $this->year && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) {
104
-			return false;
105
-		}
106
-
107
-		if ($cal->get(IntlCalendar::FIELD_MONTH) !== $cal2->get(IntlCalendar::FIELD_MONTH)) {
108
-			return false;
109
-		}
110
-
111
-		return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $cal2->get(IntlCalendar::FIELD_DAY_OF_MONTH);
112
-	}
113
-
114
-	public static function setGregorianYearForDate(int $year, IntlCalendar $calendar): IntlCalendar
115
-	{
116
-		$datetime = $calendar->toDateTime();
117
-		$yearDiff = $year - (int) $datetime->format('Y');
118
-
119
-		$calendar->set(IntlCalendar::FIELD_YEAR, $calendar->get(IntlCalendar::FIELD_YEAR) + $yearDiff);
120
-		if ($calendar->toDateTime()->format('Y') < $year) {
121
-			$calendar->set(IntlCalendar::FIELD_YEAR, $calendar->get(IntlCalendar::FIELD_YEAR) + 1);
122
-		}
123
-		if ($calendar->toDateTime()->format('Y') > $year) {
124
-			$calendar->set(IntlCalendar::FIELD_YEAR, $calendar->get(IntlCalendar::FIELD_YEAR) - 1);
125
-		}
126
-
127
-		return $calendar;
128
-	}
129
-
130
-	public function getWeekdayForGregorianYear(int $year): int
131
-	{
132
-		$cal = $this->getDayForGregorianYear($year);
133
-
134
-		return $cal->get(IntlCalendar::FIELD_DAY_OF_WEEK);
135
-	}
136
-
137
-	private function getDayForGregorianYear(int $gregorianYear): IntlCalendar
138
-	{
139
-		$cal = clone $this->calendar;
140
-		$cal->set(IntlCalendar::FIELD_MONTH, $this->month - 1);
141
-		$cal->set(IntlCalendar::FIELD_DAY_OF_MONTH, $this->day);
142
-
143
-		return self::setGregorianYearForDate($gregorianYear, $cal);
144
-	}
18
+    /** @var int */
19
+    private $day;
20
+
21
+    /** @var int */
22
+    private $month;
23
+
24
+    /** @var int|null */
25
+    private $year = null;
26
+
27
+    /** @var IntlCalendar */
28
+    private $calendar;
29
+
30
+    public function __construct(int $day, int $month, IntlCalendar $calendar)
31
+    {
32
+        $this->day = $day;
33
+        $this->month = $month;
34
+        $this->calendar = $calendar;
35
+        $this->calendar->set(IntlCalendar::FIELD_DAY_OF_MONTH, $day);
36
+        $this->calendar->set(IntlCalendar::FIELD_MONTH, $month - 1);
37
+        $this->calendar->set(IntlCalendar::FIELD_HOUR_OF_DAY, 12);
38
+        $this->calendar->set(IntlCalendar::FIELD_MINUTE, 0);
39
+        $this->calendar->set(IntlCalendar::FIELD_SECOND, 0);
40
+        $this->calendar->set(IntlCalendar::FIELD_MILLISECOND, 0);
41
+    }
42
+
43
+    public function setYear(int $year): void
44
+    {
45
+        $this->year = $year;
46
+        $this->calendar->set(IntlCalendar::FIELD_YEAR, $year);
47
+    }
48
+
49
+    public function setGregorianYear(int $year): void
50
+    {
51
+        $calendarYear = (int) $this->calendar->toDateTime()->format('Y');
52
+
53
+        $diff = $year - $calendarYear;
54
+        $realYear = $this->calendar->get(IntlCalendar::FIELD_YEAR);
55
+
56
+        $this->year = $realYear + $diff;
57
+        $this->calendar->add(IntlCalendar::FIELD_YEAR, $diff);
58
+    }
59
+
60
+    public function isSameDay(DateTimeInterface $dateTime): bool
61
+    {
62
+        $cal = clone $this->calendar;
63
+        $cal->setTime($dateTime->getTimestamp() * 1000);
64
+
65
+        if (null !== $this->year &&
66
+            $cal->get(IntlCalendar::FIELD_YEAR) !== $this->calendar->get(IntlCalendar::FIELD_YEAR)
67
+        ) {
68
+            return false;
69
+        }
70
+
71
+        if ($cal->get(IntlCalendar::FIELD_MONTH) !== $this->calendar->get(IntlCalendar::FIELD_MONTH)) {
72
+            return false;
73
+        }
74
+
75
+        return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $this->calendar->get(IntlCalendar::FIELD_DAY_OF_MONTH);
76
+    }
77
+
78
+    public function getCalendar(): IntlCalendar
79
+    {
80
+        return clone $this->calendar;
81
+    }
82
+
83
+    public function hasYearSet(): bool
84
+    {
85
+        return null !== $this->year;
86
+    }
87
+
88
+    public function isFollowUpDay(DateTimeInterface $dateTime, string $followUpDay): bool
89
+    {
90
+        return $this->isModifiedDate($dateTime, $followUpDay, 'next');
91
+    }
92
+
93
+    private function isModifiedDate(DateTimeInterface $dateTime, string $modifiedDay, string $direction): bool
94
+    {
95
+        $cal = clone $this->calendar;
96
+        $cal = self::setGregorianYearForDate((int) $dateTime->format('Y'), $cal);
97
+        $day = $cal->toDateTime();
98
+        $day->modify($direction . ' ' . $modifiedDay);
99
+        $cal->setTime($day->getTimestamp() * 1000);
100
+        $cal2 = clone $this->calendar;
101
+        $cal2->setTime($dateTime->getTimestamp() * 1000);
102
+
103
+        if (null !== $this->year && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) {
104
+            return false;
105
+        }
106
+
107
+        if ($cal->get(IntlCalendar::FIELD_MONTH) !== $cal2->get(IntlCalendar::FIELD_MONTH)) {
108
+            return false;
109
+        }
110
+
111
+        return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $cal2->get(IntlCalendar::FIELD_DAY_OF_MONTH);
112
+    }
113
+
114
+    public static function setGregorianYearForDate(int $year, IntlCalendar $calendar): IntlCalendar
115
+    {
116
+        $datetime = $calendar->toDateTime();
117
+        $yearDiff = $year - (int) $datetime->format('Y');
118
+
119
+        $calendar->set(IntlCalendar::FIELD_YEAR, $calendar->get(IntlCalendar::FIELD_YEAR) + $yearDiff);
120
+        if ($calendar->toDateTime()->format('Y') < $year) {
121
+            $calendar->set(IntlCalendar::FIELD_YEAR, $calendar->get(IntlCalendar::FIELD_YEAR) + 1);
122
+        }
123
+        if ($calendar->toDateTime()->format('Y') > $year) {
124
+            $calendar->set(IntlCalendar::FIELD_YEAR, $calendar->get(IntlCalendar::FIELD_YEAR) - 1);
125
+        }
126
+
127
+        return $calendar;
128
+    }
129
+
130
+    public function getWeekdayForGregorianYear(int $year): int
131
+    {
132
+        $cal = $this->getDayForGregorianYear($year);
133
+
134
+        return $cal->get(IntlCalendar::FIELD_DAY_OF_WEEK);
135
+    }
136
+
137
+    private function getDayForGregorianYear(int $gregorianYear): IntlCalendar
138
+    {
139
+        $cal = clone $this->calendar;
140
+        $cal->set(IntlCalendar::FIELD_MONTH, $this->month - 1);
141
+        $cal->set(IntlCalendar::FIELD_DAY_OF_MONTH, $this->day);
142
+
143
+        return self::setGregorianYearForDate($gregorianYear, $cal);
144
+    }
145 145
 }
Please login to merge, or discard this patch.
src/Factory/EasterOrthodoxFactory.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
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,
27
-			$element->getAttribute('free') === "true",
28
-			(int) $element->getAttribute('offset')
29
-		);
30
-	}
25
+        return new EasterOrthodox(
26
+            $element->textContent,
27
+            $element->getAttribute('free') === "true",
28
+            (int) $element->getAttribute('offset')
29
+        );
30
+    }
31 31
 }
Please login to merge, or discard this patch.
src/Factory/ObservanceDecoratorFactory.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
16 16
 
17 17
 class ObservanceDecoratorFactory implements DecorateFromDomElement
18 18
 {
19
-	public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface
20
-	{
21
-		if (!$domElement->hasAttribute('firstobservance') && !$domElement->hasAttribute('lastobservance')) {
22
-			return $element;
23
-		}
19
+    public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface
20
+    {
21
+        if (!$domElement->hasAttribute('firstobservance') && !$domElement->hasAttribute('lastobservance')) {
22
+            return $element;
23
+        }
24 24
 
25
-		return new ObservanceDecorator(
26
-			$element,
27
-			$domElement->hasAttribute('firstobservance') ? (int) $domElement->getAttribute('firstobservance') : null,
28
-			$domElement->hasAttribute('lastobservance') ? (int) $domElement->getAttribute('lastobservance') : null,
29
-		);
30
-	}
25
+        return new ObservanceDecorator(
26
+            $element,
27
+            $domElement->hasAttribute('firstobservance') ? (int) $domElement->getAttribute('firstobservance') : null,
28
+            $domElement->hasAttribute('lastobservance') ? (int) $domElement->getAttribute('lastobservance') : null,
29
+        );
30
+    }
31 31
 }
Please login to merge, or discard this patch.
src/Factory/DateFactory.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -17,28 +17,28 @@
 block discarded – undo
17 17
 
18 18
 class DateFactory implements ItemFromDomElementCreator
19 19
 {
20
-	public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface
21
-	{
22
-		if ($element->nodeName !== 'date') {
23
-			return null;
24
-		}
25
-
26
-		$day = CalendarDayFactory::createCalendarDay(
27
-			(int) $element->getAttribute('day'),
28
-			(int) $element->getAttribute('month'),
29
-			($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian')
30
-		);
31
-
32
-		if ($element->hasAttribute('year')) {
33
-			$day->setYear((int) $element->getAttribute('year'));
34
-		}
35
-
36
-		$date = new Date(
37
-			$element->textContent,
38
-			$element->getAttribute('free') === "true",
39
-			$day,
40
-		);
41
-
42
-		return $date;
43
-	}
20
+    public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface
21
+    {
22
+        if ($element->nodeName !== 'date') {
23
+            return null;
24
+        }
25
+
26
+        $day = CalendarDayFactory::createCalendarDay(
27
+            (int) $element->getAttribute('day'),
28
+            (int) $element->getAttribute('month'),
29
+            ($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian')
30
+        );
31
+
32
+        if ($element->hasAttribute('year')) {
33
+            $day->setYear((int) $element->getAttribute('year'));
34
+        }
35
+
36
+        $date = new Date(
37
+            $element->textContent,
38
+            $element->getAttribute('free') === "true",
39
+            $day,
40
+        );
41
+
42
+        return $date;
43
+    }
44 44
 }
Please login to merge, or discard this patch.
src/Factory/SwapDecoratorFactory.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -22,57 +22,57 @@
 block discarded – undo
22 22
 
23 23
 final class SwapDecoratorFactory implements DecorateFromDomElement
24 24
 {
25
-	public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface
26
-	{
27
-		$rules = $this->getRulesFromDomElement($domElement);
25
+    public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface
26
+    {
27
+        $rules = $this->getRulesFromDomElement($domElement);
28 28
 
29
-		if ($rules === []) {
30
-			return $element;
31
-		}
29
+        if ($rules === []) {
30
+            return $element;
31
+        }
32 32
 
33
-		$day = CalendarDayFactory::createCalendarDay(
34
-			(int) $domElement->getAttribute('day'),
35
-			(int) $domElement->getAttribute('month'),
36
-			($domElement->hasAttribute('calendar') ? $domElement->getAttribute('calendar') : 'gregorian')
37
-		);
33
+        $day = CalendarDayFactory::createCalendarDay(
34
+            (int) $domElement->getAttribute('day'),
35
+            (int) $domElement->getAttribute('month'),
36
+            ($domElement->hasAttribute('calendar') ? $domElement->getAttribute('calendar') : 'gregorian')
37
+        );
38 38
 
39
-		if ($domElement->hasAttribute('year')) {
40
-			$day->setYear((int) $domElement->getAttribute('year'));
41
-		}
39
+        if ($domElement->hasAttribute('year')) {
40
+            $day->setYear((int) $domElement->getAttribute('year'));
41
+        }
42 42
 
43
-		return new SwapDecorator($element, $day, ...$rules);
44
-	}
43
+        return new SwapDecorator($element, $day, ...$rules);
44
+    }
45 45
 
46
-	/**
47
-	 * @return SwapRule[]
48
-	 */
49
-	private function getRulesFromDomElement(DOMElement $domElement): array
50
-	{
51
-		$attributes = [
52
-			'forward' => SwapDirection::forward(),
53
-			'alternateforward' => SwapDirection::forward(),
54
-			'rewind' => SwapDirection::rewind(),
55
-			'alternaterewind' => SwapDirection::rewind(),
56
-		];
46
+    /**
47
+     * @return SwapRule[]
48
+     */
49
+    private function getRulesFromDomElement(DOMElement $domElement): array
50
+    {
51
+        $attributes = [
52
+            'forward' => SwapDirection::forward(),
53
+            'alternateforward' => SwapDirection::forward(),
54
+            'rewind' => SwapDirection::rewind(),
55
+            'alternaterewind' => SwapDirection::rewind(),
56
+        ];
57 57
 
58
-		$rules = [];
59
-		foreach ($attributes as $attribute => $direction) {
60
-			if ($domElement->hasAttribute($attribute . 'to') && $domElement->hasAttribute($attribute . 'when')) {
61
-				$rules[] = $this->createRuleFrom($domElement->getAttribute($attribute . 'to'), $domElement->getAttribute($attribute . 'when'), $direction);
62
-			}
63
-		}
58
+        $rules = [];
59
+        foreach ($attributes as $attribute => $direction) {
60
+            if ($domElement->hasAttribute($attribute . 'to') && $domElement->hasAttribute($attribute . 'when')) {
61
+                $rules[] = $this->createRuleFrom($domElement->getAttribute($attribute . 'to'), $domElement->getAttribute($attribute . 'when'), $direction);
62
+            }
63
+        }
64 64
 
65
-		return $rules;
66
-	}
65
+        return $rules;
66
+    }
67 67
 
68
-	private function createRuleFrom(string $to, string $when, SwapDirection $direction): SwapRule
69
-	{
70
-		return new SwapRule(
71
-			$direction,
72
-			GregorianWeekday::fromString($to),
73
-			...array_map(function ($item) {
74
-				return GregorianWeekday::fromString($item);
75
-			}, explode(' ', $when))
76
-		);
77
-	}
68
+    private function createRuleFrom(string $to, string $when, SwapDirection $direction): SwapRule
69
+    {
70
+        return new SwapRule(
71
+            $direction,
72
+            GregorianWeekday::fromString($to),
73
+            ...array_map(function ($item) {
74
+                return GregorianWeekday::fromString($item);
75
+            }, explode(' ', $when))
76
+        );
77
+    }
78 78
 }
Please login to merge, or discard this patch.
src/IteratorItem/EasterOrthodox.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -40,41 +40,41 @@
 block discarded – undo
40 40
 
41 41
 class EasterOrthodox extends Easter
42 42
 {
43
-	protected function getEaster(int $year): DateTimeImmutable
44
-	{
45
-		$jewishYear = 3760 + $year;
46
-		$endOfPessach = new DateTimeImmutable(
47
-			'@' . jdtounix(jewishtojd(1, 20, $jewishYear))
48
-		);
49
-		$orthodoxEaster = $this->getOrthodoxEaster($year);
50
-		if ($endOfPessach > $orthodoxEaster) {
51
-			$weekday = (int) $endOfPessach->format('w');
52
-			return $endOfPessach->add(new DateInterval('P' . (7 - $weekday) . 'D'));
53
-		}
43
+    protected function getEaster(int $year): DateTimeImmutable
44
+    {
45
+        $jewishYear = 3760 + $year;
46
+        $endOfPessach = new DateTimeImmutable(
47
+            '@' . jdtounix(jewishtojd(1, 20, $jewishYear))
48
+        );
49
+        $orthodoxEaster = $this->getOrthodoxEaster($year);
50
+        if ($endOfPessach > $orthodoxEaster) {
51
+            $weekday = (int) $endOfPessach->format('w');
52
+            return $endOfPessach->add(new DateInterval('P' . (7 - $weekday) . 'D'));
53
+        }
54 54
 
55
-		return $orthodoxEaster;
56
-	}
55
+        return $orthodoxEaster;
56
+    }
57 57
 
58
-	/**
59
-	 * @param int $year
60
-	 *
61
-	 * @return DateTimeImmutable
62
-	 * @see http://www.smart.net/~mmontes/ortheast.html
63
-	 */
64
-	private function getOrthodoxEaster(int $year): DateTimeImmutable
65
-	{
66
-		$r1 = $year % 19;
67
-		$r2 = $year % 4;
68
-		$r3 = $year % 7;
69
-		$rA = 19 * $r1 + 16;
70
-		$r4 = $rA % 30;
71
-		$rB = 2 * $r2 + 4 * $r3 + 6 * $r4;
72
-		$r5 = $rB % 7;
73
-		$rC = $r4 + $r5;
58
+    /**
59
+     * @param int $year
60
+     *
61
+     * @return DateTimeImmutable
62
+     * @see http://www.smart.net/~mmontes/ortheast.html
63
+     */
64
+    private function getOrthodoxEaster(int $year): DateTimeImmutable
65
+    {
66
+        $r1 = $year % 19;
67
+        $r2 = $year % 4;
68
+        $r3 = $year % 7;
69
+        $rA = 19 * $r1 + 16;
70
+        $r4 = $rA % 30;
71
+        $rB = 2 * $r2 + 4 * $r3 + 6 * $r4;
72
+        $r5 = $rB % 7;
73
+        $rC = $r4 + $r5;
74 74
 
75
-		// Don't touch this. It just seems to work…
76
-		// And doing the "same" in DateTime (adding a period of $rC days doesn't
77
-		// yield the same result…
78
-		return new DateTimeImmutable('@' . jdtounix(juliantojd(3, 21, $year) + $rC));
79
-	}
75
+        // Don't touch this. It just seems to work…
76
+        // And doing the "same" in DateTime (adding a period of $rC days doesn't
77
+        // yield the same result…
78
+        return new DateTimeImmutable('@' . jdtounix(juliantojd(3, 21, $year) + $rC));
79
+    }
80 80
 }
Please login to merge, or discard this patch.
src/IteratorItem/Date.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -38,34 +38,34 @@
 block discarded – undo
38 38
 
39 39
 class Date implements HolidayIteratorItemInterface
40 40
 {
41
-	/** @var CalendarDay */
42
-	private $calendarDay;
41
+    /** @var CalendarDay */
42
+    private $calendarDay;
43 43
 
44
-	/** @var bool */
45
-	private $holiday;
44
+    /** @var bool */
45
+    private $holiday;
46 46
 
47
-	/** @var string */
48
-	private $name;
47
+    /** @var string */
48
+    private $name;
49 49
 
50
-	public function __construct(string $name, bool $holiday, CalendarDay $day)
51
-	{
52
-		$this->calendarDay = $day;
53
-		$this->holiday = $holiday;
54
-		$this->name = $name;
55
-	}
50
+    public function __construct(string $name, bool $holiday, CalendarDay $day)
51
+    {
52
+        $this->calendarDay = $day;
53
+        $this->holiday = $holiday;
54
+        $this->name = $name;
55
+    }
56 56
 
57
-	public function dateMatches(DateTimeInterface $date): bool
58
-	{
59
-		return $this->calendarDay->isSameDay($date);
60
-	}
57
+    public function dateMatches(DateTimeInterface $date): bool
58
+    {
59
+        return $this->calendarDay->isSameDay($date);
60
+    }
61 61
 
62
-	public function getName(): string
63
-	{
64
-		return $this->name;
65
-	}
62
+    public function getName(): string
63
+    {
64
+        return $this->name;
65
+    }
66 66
 
67
-	public function isHoliday(): bool
68
-	{
69
-		return $this->holiday;
70
-	}
67
+    public function isHoliday(): bool
68
+    {
69
+        return $this->holiday;
70
+    }
71 71
 }
Please login to merge, or discard this patch.
src/IteratorItem/Relative.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -39,53 +39,53 @@
 block discarded – undo
39 39
 
40 40
 class Relative implements HolidayIteratorItemInterface
41 41
 {
42
-	private $day;
42
+    private $day;
43 43
 
44
-	private $month;
44
+    private $month;
45 45
 
46
-	private $relation;
46
+    private $relation;
47 47
 
48
-	private $holiday;
48
+    private $holiday;
49 49
 
50
-	private $name;
50
+    private $name;
51 51
 
52
-	public function __construct(string $name, bool $holiday, int $day, int $month, string $relation)
53
-	{
54
-		$this->day = $day;
55
-		$this->month = $month;
56
-		$this->relation = $relation;
57
-		$this->holiday = $holiday;
58
-		$this->name = $name;
59
-	}
52
+    public function __construct(string $name, bool $holiday, int $day, int $month, string $relation)
53
+    {
54
+        $this->day = $day;
55
+        $this->month = $month;
56
+        $this->relation = $relation;
57
+        $this->holiday = $holiday;
58
+        $this->name = $name;
59
+    }
60 60
 
61
-	public function dateMatches(DateTimeInterface $date): bool
62
-	{
63
-		$year = (int) $date->format('Y');
61
+    public function dateMatches(DateTimeInterface $date): bool
62
+    {
63
+        $year = (int) $date->format('Y');
64 64
 
65
-		$day = new DateTimeImmutable(sprintf(
66
-			'%s-%s-%s',
67
-			$year,
68
-			$this->month,
69
-			$this->day
70
-		));
65
+        $day = new DateTimeImmutable(sprintf(
66
+            '%s-%s-%s',
67
+            $year,
68
+            $this->month,
69
+            $this->day
70
+        ));
71 71
 
72
-		/** @var DateTimeImmutable|false $day */
73
-		$day = $day->modify($this->relation);
72
+        /** @var DateTimeImmutable|false $day */
73
+        $day = $day->modify($this->relation);
74 74
 
75
-		if ($day === false) {
76
-			return false;
77
-		}
75
+        if ($day === false) {
76
+            return false;
77
+        }
78 78
 
79
-		return $date->format('Y-m-d') === $day->format('Y-m-d');
80
-	}
79
+        return $date->format('Y-m-d') === $day->format('Y-m-d');
80
+    }
81 81
 
82
-	public function getName(): string
83
-	{
84
-		return $this->name;
85
-	}
82
+    public function getName(): string
83
+    {
84
+        return $this->name;
85
+    }
86 86
 
87
-	public function isHoliday(): bool
88
-	{
89
-		return $this->holiday;
90
-	}
87
+    public function isHoliday(): bool
88
+    {
89
+        return $this->holiday;
90
+    }
91 91
 }
Please login to merge, or discard this patch.
src/IteratorItem/DateFollowUp.php 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -41,76 +41,76 @@
 block discarded – undo
41 41
 
42 42
 class DateFollowUp implements HolidayIteratorItemInterface
43 43
 {
44
-	/** @var CalendarDay */
45
-	private $day;
46
-
47
-	/** @var bool */
48
-	private $holiday;
49
-
50
-	/** @var string */
51
-	private $name;
52
-
53
-	/** @var string */
54
-	private $followup;
55
-
56
-	/** @var array */
57
-	private $replaced;
58
-
59
-	public function __construct(string $name, bool $holiday, CalendarDay $day, string $followup, array $replaced = [])
60
-	{
61
-		$this->day = $day;
62
-		$this->followup = $followup;
63
-		$this->holiday = $holiday;
64
-		$this->name = $name;
65
-		$this->replaced = $this->replacedDays($replaced);
66
-	}
67
-
68
-	private static function replacedDays(array $replaced): array
69
-	{
70
-		$daymap = [
71
-			'sunday' => IntlCalendar::DOW_SUNDAY,
72
-			'monday' => IntlCalendar::DOW_MONDAY,
73
-			'tuesday' => IntlCalendar::DOW_TUESDAY,
74
-			'wednesday' => IntlCalendar::DOW_WEDNESDAY,
75
-			'thursday' => IntlCalendar::DOW_THURSDAY,
76
-			'friday' => IntlCalendar::DOW_FRIDAY,
77
-			'saturday' => IntlCalendar::DOW_SATURDAY,
78
-		];
79
-
80
-		if ([] === $replaced) {
81
-			return [
82
-				IntlCalendar::DOW_SATURDAY,
83
-				IntlCalendar::DOW_SUNDAY,
84
-			];
85
-		}
86
-
87
-		return array_map(function (string $day) use ($daymap) {
88
-			if (!isset($daymap[$day])) {
89
-				return null;
90
-			}
91
-			return $daymap[$day];
92
-		}, $replaced);
93
-	}
94
-
95
-	public function dateMatches(DateTimeInterface $date): bool
96
-	{
97
-		$gregorianYear = (int) $date->format('Y');
98
-		$weekday = $this->day->getWeekdayForGregorianYear($gregorianYear);
99
-
100
-		if (in_array($weekday, $this->replaced)) {
101
-			return $this->day->isFollowUpDay($date, $this->followup);
102
-		}
103
-
104
-		return $this->day->isSameDay($date);
105
-	}
106
-
107
-	public function getName(): string
108
-	{
109
-		return $this->name;
110
-	}
111
-
112
-	public function isHoliday(): bool
113
-	{
114
-		return $this->holiday;
115
-	}
44
+    /** @var CalendarDay */
45
+    private $day;
46
+
47
+    /** @var bool */
48
+    private $holiday;
49
+
50
+    /** @var string */
51
+    private $name;
52
+
53
+    /** @var string */
54
+    private $followup;
55
+
56
+    /** @var array */
57
+    private $replaced;
58
+
59
+    public function __construct(string $name, bool $holiday, CalendarDay $day, string $followup, array $replaced = [])
60
+    {
61
+        $this->day = $day;
62
+        $this->followup = $followup;
63
+        $this->holiday = $holiday;
64
+        $this->name = $name;
65
+        $this->replaced = $this->replacedDays($replaced);
66
+    }
67
+
68
+    private static function replacedDays(array $replaced): array
69
+    {
70
+        $daymap = [
71
+            'sunday' => IntlCalendar::DOW_SUNDAY,
72
+            'monday' => IntlCalendar::DOW_MONDAY,
73
+            'tuesday' => IntlCalendar::DOW_TUESDAY,
74
+            'wednesday' => IntlCalendar::DOW_WEDNESDAY,
75
+            'thursday' => IntlCalendar::DOW_THURSDAY,
76
+            'friday' => IntlCalendar::DOW_FRIDAY,
77
+            'saturday' => IntlCalendar::DOW_SATURDAY,
78
+        ];
79
+
80
+        if ([] === $replaced) {
81
+            return [
82
+                IntlCalendar::DOW_SATURDAY,
83
+                IntlCalendar::DOW_SUNDAY,
84
+            ];
85
+        }
86
+
87
+        return array_map(function (string $day) use ($daymap) {
88
+            if (!isset($daymap[$day])) {
89
+                return null;
90
+            }
91
+            return $daymap[$day];
92
+        }, $replaced);
93
+    }
94
+
95
+    public function dateMatches(DateTimeInterface $date): bool
96
+    {
97
+        $gregorianYear = (int) $date->format('Y');
98
+        $weekday = $this->day->getWeekdayForGregorianYear($gregorianYear);
99
+
100
+        if (in_array($weekday, $this->replaced)) {
101
+            return $this->day->isFollowUpDay($date, $this->followup);
102
+        }
103
+
104
+        return $this->day->isSameDay($date);
105
+    }
106
+
107
+    public function getName(): string
108
+    {
109
+        return $this->name;
110
+    }
111
+
112
+    public function isHoliday(): bool
113
+    {
114
+        return $this->holiday;
115
+    }
116 116
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 			];
85 85
 		}
86 86
 
87
-		return array_map(function (string $day) use ($daymap) {
87
+		return array_map(function(string $day) use ($daymap) {
88 88
 			if (!isset($daymap[$day])) {
89 89
 				return null;
90 90
 			}
Please login to merge, or discard this patch.