Completed
Push — allowFirstAndLastObservance ( b1e10f...3795fe )
by Andreas
19s
created
src/HolidayIteratorFactory.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
                 continue;
79 79
             }
80 80
 
81
-			try {
82
-				$element = $this->getElement($child);
83
-				if ($child->hasAttribute('firstobservance') || $child->hasAttribute('lastobservance')) {
84
-					$element = new ObservanceDecorator(
85
-						$element,
86
-						$child->hasAttribute('firstobservance') ? (int)$child->getAttribute('firstobservance') : null,
87
-						$child->hasAttribute('lastobservance') ? (int)$child->getAttribute('lastobservance') : null,
88
-					);
89
-				}
90
-
91
-				$iterator->append($element);
92
-			} catch (Throwable $e) {
93
-				// Do nothing on purpose
94
-			}
81
+            try {
82
+                $element = $this->getElement($child);
83
+                if ($child->hasAttribute('firstobservance') || $child->hasAttribute('lastobservance')) {
84
+                    $element = new ObservanceDecorator(
85
+                        $element,
86
+                        $child->hasAttribute('firstobservance') ? (int)$child->getAttribute('firstobservance') : null,
87
+                        $child->hasAttribute('lastobservance') ? (int)$child->getAttribute('lastobservance') : null,
88
+                    );
89
+                }
90
+
91
+                $iterator->append($element);
92
+            } catch (Throwable $e) {
93
+                // Do nothing on purpose
94
+            }
95 95
 
96 96
         }
97 97
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             default:
179 179
                 throw new RuntimeException('Unknown element encountered');
180 180
         }
181
-	}
181
+    }
182 182
 
183 183
     private function getFree(DOMElement $element): bool
184 184
     {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
         $dom->load($file);
68 68
         $dom->xinclude();
69 69
 
70
-        if (! @$dom->schemaValidate(__DIR__ . '/../share/holidays.xsd')) {
70
+        if (!@$dom->schemaValidate(__DIR__ . '/../share/holidays.xsd')) {
71 71
             throw new Exception('XML-File does not validate agains schema');
72 72
         }
73 73
         foreach ($dom->documentElement->childNodes as $child) {
74
-            if (! $child instanceof DOMElement) {
74
+            if (!$child instanceof DOMElement) {
75 75
                 continue;
76 76
             }
77 77
             if ($child->nodeName === 'resources') {
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 				if ($child->hasAttribute('firstobservance') || $child->hasAttribute('lastobservance')) {
84 84
 					$element = new ObservanceDecorator(
85 85
 						$element,
86
-						$child->hasAttribute('firstobservance') ? (int)$child->getAttribute('firstobservance') : null,
87
-						$child->hasAttribute('lastobservance') ? (int)$child->getAttribute('lastobservance') : null,
86
+						$child->hasAttribute('firstobservance') ? (int) $child->getAttribute('firstobservance') : null,
87
+						$child->hasAttribute('lastobservance') ? (int) $child->getAttribute('lastobservance') : null,
88 88
 					);
89 89
 				}
90 90
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $file = __DIR__ . '/../share/%s.xml';
111 111
         $file1 = sprintf($file, $isoCode);
112 112
 
113
-        if (! is_readable($file1)) {
113
+        if (!is_readable($file1)) {
114 114
             throw new UnexpectedValueException(sprintf(
115 115
                 'There is no holiday-file for %s',
116 116
                 $isoCode
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 $day = CalendarDayFactory::createCalendarDay(
140 140
                     (int) $child->getAttribute('day'),
141 141
                     (int) $child->getAttribute('month'),
142
-                    ($child->hasAttribute('calendar')?$child->getAttribute('calendar'): 'gregorian')
142
+                    ($child->hasAttribute('calendar') ? $child->getAttribute('calendar') : 'gregorian')
143 143
                 );
144 144
                 if ($child->hasAttribute('year')) {
145 145
                     $day->setYear((int) $child->getAttribute('year'));
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
                     $child->textContent,
149 149
                     $this->getFree($child),
150 150
                     $day,
151
-                    $child->hasAttribute('forwardto')?$child->getAttribute('forwardto'):'',
152
-                    $child->hasAttribute('forwardwhen')?explode(' ', $child->getAttribute('forwardwhen')):[],
153
-                    $child->hasAttribute('rewindto')?$child->getAttribute('rewindto'):'',
154
-                    $child->hasAttribute('rewindwhen')?explode(' ', $child->getAttribute('rewindwhen')):[],
151
+                    $child->hasAttribute('forwardto') ? $child->getAttribute('forwardto') : '',
152
+                    $child->hasAttribute('forwardwhen') ?explode(' ', $child->getAttribute('forwardwhen')) : [],
153
+                    $child->hasAttribute('rewindto') ? $child->getAttribute('rewindto') : '',
154
+                    $child->hasAttribute('rewindwhen') ?explode(' ', $child->getAttribute('rewindwhen')) : [],
155 155
                 );
156 156
             case 'dateFollowUp':
157 157
                 $day = CalendarDayFactory::createCalendarDay(
158 158
                     (int) $child->getAttribute('day'),
159 159
                     (int) $child->getAttribute('month'),
160
-                    ($child->hasAttribute('calendar')?$child->getAttribute('calendar'): 'gregorian')
160
+                    ($child->hasAttribute('calendar') ? $child->getAttribute('calendar') : 'gregorian')
161 161
                 );
162 162
 
163 163
                 return new DateFollowUp(
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                     $this->getFree($child),
166 166
                     $day,
167 167
                     $child->getAttribute('followup'),
168
-                    ($child->hasAttribute('replaced')?explode(' ', $child->getAttribute('replaced')):[])
168
+                    ($child->hasAttribute('replaced') ?explode(' ', $child->getAttribute('replaced')) : [])
169 169
                 );
170 170
             case 'relative':
171 171
                 return new Relative(
Please login to merge, or discard this patch.