Completed
Push — allowFirstAndLastObservance ( ed9201...ed70e3 )
by Andreas
36s
created
src/HolidayIteratorFactory.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
                 continue;
79 79
             }
80 80
 
81
-			try {
82
-				$element = $this->getElement($child);
83
-			} catch (Throwable $e) {
84
-				// Do nothing on purpose
85
-			}
86
-
87
-	        if ($child->hasAttribute('firstobservance') || $child->hasAttribute('lastobservance')) {
88
-		        $element = new ObservanceDecorator(
89
-			        $element,
90
-			        $child->hasAttribute('firstobservance')?(int) $child->getAttribute('firstobservance'):null,
91
-			        $child->hasAttribute('lastobservance')?(int) $child->getAttribute('lastobservance'):null,
92
-		        );
93
-	        }
81
+            try {
82
+                $element = $this->getElement($child);
83
+            } catch (Throwable $e) {
84
+                // Do nothing on purpose
85
+            }
86
+
87
+            if ($child->hasAttribute('firstobservance') || $child->hasAttribute('lastobservance')) {
88
+                $element = new ObservanceDecorator(
89
+                    $element,
90
+                    $child->hasAttribute('firstobservance')?(int) $child->getAttribute('firstobservance'):null,
91
+                    $child->hasAttribute('lastobservance')?(int) $child->getAttribute('lastobservance'):null,
92
+                );
93
+            }
94 94
 
95 95
             $iterator->append($element);
96 96
         }
@@ -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') {
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	        if ($child->hasAttribute('firstobservance') || $child->hasAttribute('lastobservance')) {
88 88
 		        $element = new ObservanceDecorator(
89 89
 			        $element,
90
-			        $child->hasAttribute('firstobservance')?(int) $child->getAttribute('firstobservance'):null,
91
-			        $child->hasAttribute('lastobservance')?(int) $child->getAttribute('lastobservance'):null,
90
+			        $child->hasAttribute('firstobservance') ? (int) $child->getAttribute('firstobservance') : null,
91
+			        $child->hasAttribute('lastobservance') ? (int) $child->getAttribute('lastobservance') : null,
92 92
 		        );
93 93
 	        }
94 94
 
@@ -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.