Passed
Push — addMultipleObservanceShifts ( 90c241...269624 )
by Andreas
01:49
created
src/Factory/ItemFromDomElementCreator.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,5 +15,5 @@
 block discarded – undo
15 15
 
16 16
 interface ItemFromDomElementCreator
17 17
 {
18
-	public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface;
18
+    public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface;
19 19
 }
Please login to merge, or discard this patch.
src/Factory/ObservanceDecoratorFactory.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 {
19 19
 	public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface
20 20
 	{
21
-		if (! $domElement->hasAttribute('firstobservance') && ! $domElement->hasAttribute('lastobservance')) {
21
+		if (!$domElement->hasAttribute('firstobservance') && !$domElement->hasAttribute('lastobservance')) {
22 22
 			return $element;
23 23
 		}
24 24
 
Please login to merge, or discard this patch.
src/Factory/RelativeFactory.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,18 +16,18 @@
 block discarded – undo
16 16
 
17 17
 class RelativeFactory implements ItemFromDomElementCreator
18 18
 {
19
-	public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface
20
-	{
21
-		if ($element->nodeName !== 'relative') {
22
-			return null;
23
-		}
19
+    public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface
20
+    {
21
+        if ($element->nodeName !== 'relative') {
22
+            return null;
23
+        }
24 24
 
25
-		return new Relative(
26
-			$element->textContent,
27
-			$element->getAttribute('free') === "true",
28
-			(int) $element->getAttribute('day'),
29
-			(int) $element->getAttribute('month'),
30
-			$element->getAttribute('relation')
31
-		);
32
-	}
25
+        return new Relative(
26
+            $element->textContent,
27
+            $element->getAttribute('free') === "true",
28
+            (int) $element->getAttribute('day'),
29
+            (int) $element->getAttribute('month'),
30
+            $element->getAttribute('relation')
31
+        );
32
+    }
33 33
 }
Please login to merge, or discard this patch.
src/Factory/DecorateFromDomElement.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,5 +15,5 @@
 block discarded – undo
15 15
 
16 16
 interface DecorateFromDomElement
17 17
 {
18
-	public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface;
18
+    public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface;
19 19
 }
Please login to merge, or discard this patch.
src/CalendarDay.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 		$day = $cal->toDateTime();
117 117
 		$day->modify($direction . ' ' . $modifiedDay);
118 118
 		$cal->setTime($day->getTimestamp() * 1000);
119
-		$cal2         = clone $this->calendar;
119
+		$cal2 = clone $this->calendar;
120 120
 		$cal2->setTime($dateTime->getTimestamp() * 1000);
121 121
 
122 122
 		if (null !== $this->year && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) {
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -91,46 +91,46 @@
 block discarded – undo
91 91
         return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $this->calendar->get(IntlCalendar::FIELD_DAY_OF_MONTH);
92 92
     }
93 93
 
94
-	public function getCalendar(): IntlCalendar
95
-	{
96
-		return clone $this->calendar;
97
-	}
94
+    public function getCalendar(): IntlCalendar
95
+    {
96
+        return clone $this->calendar;
97
+    }
98 98
 
99
-	public function hasYearSet(): bool
100
-	{
101
-		return null !== $this->year;
102
-	}
99
+    public function hasYearSet(): bool
100
+    {
101
+        return null !== $this->year;
102
+    }
103 103
 
104 104
     public function isFollowUpDay(DateTimeInterface $dateTime, string $followUpDay): bool
105 105
     {
106
-	    return $this->isModifiedDate($dateTime, $followUpDay, 'next');
106
+        return $this->isModifiedDate($dateTime, $followUpDay, 'next');
107 107
     }
108 108
 
109 109
     public function isPreviousDay(DateTimeInterface $dateTime, string $previousDay): bool
110 110
     {
111
-		return $this->isModifiedDate($dateTime, $previousDay, 'previous');
111
+        return $this->isModifiedDate($dateTime, $previousDay, 'previous');
112 112
     }
113 113
 
114
-	private function isModifiedDate(DateTimeInterface $dateTime, string $modifiedDay, string $direction): bool
115
-	{
116
-		$cal = clone $this->calendar;
117
-		$cal = self::setGregorianYearForDate((int) $dateTime->format('Y'), $cal);
118
-		$day = $cal->toDateTime();
119
-		$day->modify($direction . ' ' . $modifiedDay);
120
-		$cal->setTime($day->getTimestamp() * 1000);
121
-		$cal2         = clone $this->calendar;
122
-		$cal2->setTime($dateTime->getTimestamp() * 1000);
123
-
124
-		if (null !== $this->year && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) {
125
-			return false;
126
-		}
127
-
128
-		if ($cal->get(IntlCalendar::FIELD_MONTH) !== $cal2->get(IntlCalendar::FIELD_MONTH)) {
129
-			return false;
130
-		}
131
-
132
-		return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $cal2->get(IntlCalendar::FIELD_DAY_OF_MONTH);
133
-	}
114
+    private function isModifiedDate(DateTimeInterface $dateTime, string $modifiedDay, string $direction): bool
115
+    {
116
+        $cal = clone $this->calendar;
117
+        $cal = self::setGregorianYearForDate((int) $dateTime->format('Y'), $cal);
118
+        $day = $cal->toDateTime();
119
+        $day->modify($direction . ' ' . $modifiedDay);
120
+        $cal->setTime($day->getTimestamp() * 1000);
121
+        $cal2         = clone $this->calendar;
122
+        $cal2->setTime($dateTime->getTimestamp() * 1000);
123
+
124
+        if (null !== $this->year && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) {
125
+            return false;
126
+        }
127
+
128
+        if ($cal->get(IntlCalendar::FIELD_MONTH) !== $cal2->get(IntlCalendar::FIELD_MONTH)) {
129
+            return false;
130
+        }
131
+
132
+        return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $cal2->get(IntlCalendar::FIELD_DAY_OF_MONTH);
133
+    }
134 134
 
135 135
     public function getWeekdayForGregorianYear(int $year): int
136 136
     {
Please login to merge, or discard this patch.
src/SwapDirection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 	public static function forward(): self
45 45
 	{
46
-		if (! isset(self::$instances[self::FORWARD])) {
46
+		if (!isset(self::$instances[self::FORWARD])) {
47 47
 			self::$instances[self::FORWARD] = new self(self::FORWARD);
48 48
 		}
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public static function rewind(): self
54 54
 	{
55
-		if (! isset(self::$instances[self::REWIND])) {
55
+		if (!isset(self::$instances[self::REWIND])) {
56 56
 			self::$instances[self::REWIND] = new self(self::REWIND);
57 57
 		}
58 58
 
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -12,52 +12,52 @@
 block discarded – undo
12 12
 
13 13
 final class SwapDirection
14 14
 {
15
-	/** @var string */
16
-	private $value;
15
+    /** @var string */
16
+    private $value;
17 17
 
18
-	/** @var array<string, self> */
19
-	private static $instances = [];
18
+    /** @var array<string, self> */
19
+    private static $instances = [];
20 20
 
21
-	private const FORWARD = 'forward';
22
-	private const REWIND = 'rewind';
21
+    private const FORWARD = 'forward';
22
+    private const REWIND = 'rewind';
23 23
 
24
-	private function __construct(string $value)
24
+    private function __construct(string $value)
25 25
     {
26
-		$this->value = $value;
27
-	}
28
-
29
-	public function getValue(): string
30
-	{
31
-		return $this->value;
32
-	}
33
-
34
-	public function getDateTimeDirection(): string
35
-	{
36
-		switch ($this->value) {
37
-			case self::REWIND:
38
-				return 'previous';
39
-			case self::FORWARD:
40
-				return 'next';
41
-			default:
42
-				return '';
43
-		}
44
-	}
45
-
46
-	public static function forward(): self
47
-	{
48
-		if (! isset(self::$instances[self::FORWARD])) {
49
-			self::$instances[self::FORWARD] = new self(self::FORWARD);
50
-		}
51
-
52
-		return self::$instances[self::FORWARD];
53
-	}
54
-
55
-	public static function rewind(): self
56
-	{
57
-		if (! isset(self::$instances[self::REWIND])) {
58
-			self::$instances[self::REWIND] = new self(self::REWIND);
59
-		}
60
-
61
-		return self::$instances[self::REWIND];
62
-	}
26
+        $this->value = $value;
27
+    }
28
+
29
+    public function getValue(): string
30
+    {
31
+        return $this->value;
32
+    }
33
+
34
+    public function getDateTimeDirection(): string
35
+    {
36
+        switch ($this->value) {
37
+            case self::REWIND:
38
+                return 'previous';
39
+            case self::FORWARD:
40
+                return 'next';
41
+            default:
42
+                return '';
43
+        }
44
+    }
45
+
46
+    public static function forward(): self
47
+    {
48
+        if (! isset(self::$instances[self::FORWARD])) {
49
+            self::$instances[self::FORWARD] = new self(self::FORWARD);
50
+        }
51
+
52
+        return self::$instances[self::FORWARD];
53
+    }
54
+
55
+    public static function rewind(): self
56
+    {
57
+        if (! isset(self::$instances[self::REWIND])) {
58
+            self::$instances[self::REWIND] = new self(self::REWIND);
59
+        }
60
+
61
+        return self::$instances[self::REWIND];
62
+    }
63 63
 }
Please login to merge, or discard this patch.
src/HolidayIteratorFactory.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -52,109 +52,109 @@
 block discarded – undo
52 52
 
53 53
 class HolidayIteratorFactory
54 54
 {
55
-	/** @var ItemFromDomElementCreator[] */
56
-	private $factories;
57
-
58
-	/** @var DecorateFromDomElement[] */
59
-	private $decorators;
60
-
61
-	public function __construct()
62
-	{
63
-		$this->factories = [
64
-			new EasterFactory(),
65
-			new EasterOrthodoxFactory(),
66
-			new DateFactory(),
67
-			new DateFollowupFactory(),
68
-			new RelativeFactory(),
69
-		];
70
-
71
-		$this->decorators = [
72
-			new ObservanceDecoratorFactory(),
73
-			new SwapDecoratorFactory(),
74
-		];
75
-	}
76
-
77
-	/**
78
-	 * Create a HolidayIterator from an XML-File
79
-	 *
80
-	 * The provided XML-File has to validate against the holiday.xsd-file you
81
-	 * can find in this projects "share" folder.
82
-	 *
83
-	 * @param string $file
84
-	 *
85
-	 * @return HolidayIterator
86
-	 */
87
-	public function createIteratorFromXmlFile(string $file): HolidayIterator
88
-	{
89
-		$iterator = new HolidayIterator();
90
-
91
-		$dom = new DOMDocument('1.0', 'UTF-8');
92
-		$dom->load($file);
93
-		$dom->xinclude();
94
-
95
-		if (!@$dom->schemaValidate(__DIR__ . '/../share/holidays.xsd')) {
96
-			throw new Exception('XML-File does not validate agains schema');
97
-		}
98
-		foreach ($dom->documentElement->childNodes as $child) {
99
-			if (!$child instanceof DOMElement) {
100
-				continue;
101
-			}
102
-			if ($child->nodeName === 'resources') {
103
-				continue;
104
-			}
105
-
106
-			try {
107
-				$element = $this->getElement($child);
108
-				$element = $this->decorateElement($element, $child);
109
-				$iterator->append($element);
110
-			} catch (Throwable $e) {
111
-				// Do nothing on purpose
112
-			}
113
-		}
114
-
115
-		return $iterator;
116
-	}
117
-
118
-	/**
119
-	 * Create a HolidayIterator from an ISO 3166-code.
120
-	 *
121
-	 * @param string $isoCode
122
-	 *
123
-	 * @return HolidayIterator
124
-	 */
125
-	public function createIteratorFromISO3166(string $isoCode): HolidayIterator
126
-	{
127
-		$file = __DIR__ . '/../share/%s.xml';
128
-		$file1 = sprintf($file, $isoCode);
129
-
130
-		if (!is_readable($file1)) {
131
-			throw new UnexpectedValueException(sprintf(
132
-				'There is no holiday-file for %s',
133
-				$isoCode
134
-			));
135
-		}
136
-
137
-		return $this->createIteratorFromXmlFile($file1);
138
-	}
139
-
140
-	private function getElement(DOMElement $child): HolidayIteratorItemInterface
141
-	{
142
-		foreach ($this->factories as $factory) {
143
-			$element = $factory->itemFromDomElement($child);
144
-			if ($element instanceof HolidayIteratorItemInterface) {
145
-				return $element;
146
-			}
147
-		}
148
-
149
-		throw new RuntimeException('Unknown element encountered');
150
-	}
151
-
152
-	private function decorateElement(HolidayIteratorItemInterface $element, DOMElement $child): HolidayIteratorItemInterface
153
-	{
154
-		foreach ($this->decorators as $decorator) {
155
-			$element = $decorator->decorate($element, $child);
156
-		}
157
-
158
-		return $element;
159
-	}
55
+    /** @var ItemFromDomElementCreator[] */
56
+    private $factories;
57
+
58
+    /** @var DecorateFromDomElement[] */
59
+    private $decorators;
60
+
61
+    public function __construct()
62
+    {
63
+        $this->factories = [
64
+            new EasterFactory(),
65
+            new EasterOrthodoxFactory(),
66
+            new DateFactory(),
67
+            new DateFollowupFactory(),
68
+            new RelativeFactory(),
69
+        ];
70
+
71
+        $this->decorators = [
72
+            new ObservanceDecoratorFactory(),
73
+            new SwapDecoratorFactory(),
74
+        ];
75
+    }
76
+
77
+    /**
78
+     * Create a HolidayIterator from an XML-File
79
+     *
80
+     * The provided XML-File has to validate against the holiday.xsd-file you
81
+     * can find in this projects "share" folder.
82
+     *
83
+     * @param string $file
84
+     *
85
+     * @return HolidayIterator
86
+     */
87
+    public function createIteratorFromXmlFile(string $file): HolidayIterator
88
+    {
89
+        $iterator = new HolidayIterator();
90
+
91
+        $dom = new DOMDocument('1.0', 'UTF-8');
92
+        $dom->load($file);
93
+        $dom->xinclude();
94
+
95
+        if (!@$dom->schemaValidate(__DIR__ . '/../share/holidays.xsd')) {
96
+            throw new Exception('XML-File does not validate agains schema');
97
+        }
98
+        foreach ($dom->documentElement->childNodes as $child) {
99
+            if (!$child instanceof DOMElement) {
100
+                continue;
101
+            }
102
+            if ($child->nodeName === 'resources') {
103
+                continue;
104
+            }
105
+
106
+            try {
107
+                $element = $this->getElement($child);
108
+                $element = $this->decorateElement($element, $child);
109
+                $iterator->append($element);
110
+            } catch (Throwable $e) {
111
+                // Do nothing on purpose
112
+            }
113
+        }
114
+
115
+        return $iterator;
116
+    }
117
+
118
+    /**
119
+     * Create a HolidayIterator from an ISO 3166-code.
120
+     *
121
+     * @param string $isoCode
122
+     *
123
+     * @return HolidayIterator
124
+     */
125
+    public function createIteratorFromISO3166(string $isoCode): HolidayIterator
126
+    {
127
+        $file = __DIR__ . '/../share/%s.xml';
128
+        $file1 = sprintf($file, $isoCode);
129
+
130
+        if (!is_readable($file1)) {
131
+            throw new UnexpectedValueException(sprintf(
132
+                'There is no holiday-file for %s',
133
+                $isoCode
134
+            ));
135
+        }
136
+
137
+        return $this->createIteratorFromXmlFile($file1);
138
+    }
139
+
140
+    private function getElement(DOMElement $child): HolidayIteratorItemInterface
141
+    {
142
+        foreach ($this->factories as $factory) {
143
+            $element = $factory->itemFromDomElement($child);
144
+            if ($element instanceof HolidayIteratorItemInterface) {
145
+                return $element;
146
+            }
147
+        }
148
+
149
+        throw new RuntimeException('Unknown element encountered');
150
+    }
151
+
152
+    private function decorateElement(HolidayIteratorItemInterface $element, DOMElement $child): HolidayIteratorItemInterface
153
+    {
154
+        foreach ($this->decorators as $decorator) {
155
+            $element = $decorator->decorate($element, $child);
156
+        }
157
+
158
+        return $element;
159
+    }
160 160
 }
Please login to merge, or discard this patch.
src/Factory/SwapDecoratorFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 		return new SwapRule(
62 62
 			$direction,
63 63
 			GregorianWeekday::fromString($to),
64
-			...array_map(function ($item) {
64
+			...array_map(function($item) {
65 65
 				return GregorianWeekday::fromString($item);
66 66
 			}, explode(' ', $when))
67 67
 		);
Please login to merge, or discard this patch.
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -22,48 +22,48 @@
 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 = [];
25
+    public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface
26
+    {
27
+        $rules = [];
28 28
 
29
-		if ($domElement->hasAttribute('forwardto') && $domElement->hasAttribute('forwardwhen')) {
30
-			$rules[] = $this->createRuleFrom($domElement->getAttribute('forwardto'), $domElement->getAttribute('forwardwhen'), SwapDirection::forward());
31
-		}
32
-		if ($domElement->hasAttribute('alternateforwardto') && $domElement->hasAttribute('alternateforwardwhen')) {
33
-			$rules[] = $this->createRuleFrom($domElement->getAttribute('alternateforwardto'), $domElement->getAttribute('alternateforwardwhen'), SwapDirection::forward());
34
-		}
35
-		if ($domElement->hasAttribute('rewindto') && $domElement->hasAttribute('rewindwhen')) {
36
-			$rules[] = $this->createRuleFrom($domElement->getAttribute('rewindto'), $domElement->getAttribute('rewindwhen'), SwapDirection::rewind());
37
-		}
38
-		if ($domElement->hasAttribute('alternaterewindto') && $domElement->hasAttribute('alternaterewindwhen')) {
39
-			$rules[] = $this->createRuleFrom($domElement->getAttribute('alternaterewindto'), $domElement->getAttribute('alternaterewindwhen'), SwapDirection::rewind());
40
-		}
29
+        if ($domElement->hasAttribute('forwardto') && $domElement->hasAttribute('forwardwhen')) {
30
+            $rules[] = $this->createRuleFrom($domElement->getAttribute('forwardto'), $domElement->getAttribute('forwardwhen'), SwapDirection::forward());
31
+        }
32
+        if ($domElement->hasAttribute('alternateforwardto') && $domElement->hasAttribute('alternateforwardwhen')) {
33
+            $rules[] = $this->createRuleFrom($domElement->getAttribute('alternateforwardto'), $domElement->getAttribute('alternateforwardwhen'), SwapDirection::forward());
34
+        }
35
+        if ($domElement->hasAttribute('rewindto') && $domElement->hasAttribute('rewindwhen')) {
36
+            $rules[] = $this->createRuleFrom($domElement->getAttribute('rewindto'), $domElement->getAttribute('rewindwhen'), SwapDirection::rewind());
37
+        }
38
+        if ($domElement->hasAttribute('alternaterewindto') && $domElement->hasAttribute('alternaterewindwhen')) {
39
+            $rules[] = $this->createRuleFrom($domElement->getAttribute('alternaterewindto'), $domElement->getAttribute('alternaterewindwhen'), SwapDirection::rewind());
40
+        }
41 41
 
42
-		if ($rules === []) {
43
-			return $element;
44
-		}
42
+        if ($rules === []) {
43
+            return $element;
44
+        }
45 45
 
46
-		$day = CalendarDayFactory::createCalendarDay(
47
-			(int) $domElement->getAttribute('day'),
48
-			(int) $domElement->getAttribute('month'),
49
-			($domElement->hasAttribute('calendar') ? $domElement->getAttribute('calendar') : 'gregorian')
50
-		);
46
+        $day = CalendarDayFactory::createCalendarDay(
47
+            (int) $domElement->getAttribute('day'),
48
+            (int) $domElement->getAttribute('month'),
49
+            ($domElement->hasAttribute('calendar') ? $domElement->getAttribute('calendar') : 'gregorian')
50
+        );
51 51
 
52
-		if ($domElement->hasAttribute('year')) {
53
-			$day->setYear((int) $domElement->getAttribute('year'));
54
-		}
52
+        if ($domElement->hasAttribute('year')) {
53
+            $day->setYear((int) $domElement->getAttribute('year'));
54
+        }
55 55
 
56
-		return new SwapDecorator($element, $day, ...$rules);
57
-	}
56
+        return new SwapDecorator($element, $day, ...$rules);
57
+    }
58 58
 
59
-	private function createRuleFrom(string $to, string $when, SwapDirection $direction): SwapRule
60
-	{
61
-		return new SwapRule(
62
-			$direction,
63
-			GregorianWeekday::fromString($to),
64
-			...array_map(function ($item) {
65
-				return GregorianWeekday::fromString($item);
66
-			}, explode(' ', $when))
67
-		);
68
-	}
59
+    private function createRuleFrom(string $to, string $when, SwapDirection $direction): SwapRule
60
+    {
61
+        return new SwapRule(
62
+            $direction,
63
+            GregorianWeekday::fromString($to),
64
+            ...array_map(function ($item) {
65
+                return GregorianWeekday::fromString($item);
66
+            }, explode(' ', $when))
67
+        );
68
+    }
69 69
 }
Please login to merge, or discard this patch.
src/Factory/DateFactory.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -22,28 +22,28 @@
 block discarded – undo
22 22
 
23 23
 class DateFactory implements ItemFromDomElementCreator
24 24
 {
25
-	public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface
26
-	{
27
-		if ($element->nodeName !== 'date') {
28
-			return null;
29
-		}
30
-
31
-		$day = CalendarDayFactory::createCalendarDay(
32
-			(int) $element->getAttribute('day'),
33
-			(int) $element->getAttribute('month'),
34
-			($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian')
35
-		);
36
-
37
-		if ($element->hasAttribute('year')) {
38
-			$day->setYear((int) $element->getAttribute('year'));
39
-		}
40
-
41
-		$date = new Date(
42
-			$element->textContent,
25
+    public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface
26
+    {
27
+        if ($element->nodeName !== 'date') {
28
+            return null;
29
+        }
30
+
31
+        $day = CalendarDayFactory::createCalendarDay(
32
+            (int) $element->getAttribute('day'),
33
+            (int) $element->getAttribute('month'),
34
+            ($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian')
35
+        );
36
+
37
+        if ($element->hasAttribute('year')) {
38
+            $day->setYear((int) $element->getAttribute('year'));
39
+        }
40
+
41
+        $date = new Date(
42
+            $element->textContent,
43 43
             $element->getAttribute('free') === "true",
44
-			$day,
45
-		);
44
+            $day,
45
+        );
46 46
 
47
-		return $date;
48
-	}
47
+        return $date;
48
+    }
49 49
 }
Please login to merge, or discard this patch.