Completed
Push — allowFirstAndLastObservance ( 3795fe...50f166 )
by Andreas
15s
created
src/HolidayIteratorFactory.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
         $dom->load($file);
67 67
         $dom->xinclude();
68 68
 
69
-        if (! @$dom->schemaValidate(__DIR__ . '/../share/holidays.xsd')) {
69
+        if (!@$dom->schemaValidate(__DIR__ . '/../share/holidays.xsd')) {
70 70
             throw new Exception('XML-File does not validate agains schema');
71 71
         }
72 72
         foreach ($dom->documentElement->childNodes as $child) {
73
-            if (! $child instanceof DOMElement) {
73
+            if (!$child instanceof DOMElement) {
74 74
                 continue;
75 75
             }
76 76
             if ($child->nodeName === 'resources') {
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $file = __DIR__ . '/../share/%s.xml';
95 95
         $file1 = sprintf($file, $isoCode);
96 96
 
97
-        if (! is_readable($file1)) {
97
+        if (!is_readable($file1)) {
98 98
             throw new UnexpectedValueException(sprintf(
99 99
                 'There is no holiday-file for %s',
100 100
                 $isoCode
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 $day = CalendarDayFactory::createCalendarDay(
124 124
                     (int) $child->getAttribute('day'),
125 125
                     (int) $child->getAttribute('month'),
126
-                    ($child->hasAttribute('calendar')?$child->getAttribute('calendar'): 'gregorian')
126
+                    ($child->hasAttribute('calendar') ? $child->getAttribute('calendar') : 'gregorian')
127 127
                 );
128 128
                 if ($child->hasAttribute('year')) {
129 129
                     $day->setYear((int) $child->getAttribute('year'));
@@ -132,16 +132,16 @@  discard block
 block discarded – undo
132 132
                     $child->textContent,
133 133
                     $this->getFree($child),
134 134
                     $day,
135
-                    $child->hasAttribute('forwardto')?$child->getAttribute('forwardto'):'',
136
-                    $child->hasAttribute('forwardwhen')?explode(' ', $child->getAttribute('forwardwhen')):[],
137
-                    $child->hasAttribute('rewindto')?$child->getAttribute('rewindto'):'',
138
-                    $child->hasAttribute('rewindwhen')?explode(' ', $child->getAttribute('rewindwhen')):[],
135
+                    $child->hasAttribute('forwardto') ? $child->getAttribute('forwardto') : '',
136
+                    $child->hasAttribute('forwardwhen') ?explode(' ', $child->getAttribute('forwardwhen')) : [],
137
+                    $child->hasAttribute('rewindto') ? $child->getAttribute('rewindto') : '',
138
+                    $child->hasAttribute('rewindwhen') ?explode(' ', $child->getAttribute('rewindwhen')) : [],
139 139
                 );
140 140
             case 'dateFollowUp':
141 141
                 $day = CalendarDayFactory::createCalendarDay(
142 142
                     (int) $child->getAttribute('day'),
143 143
                     (int) $child->getAttribute('month'),
144
-                    ($child->hasAttribute('calendar')?$child->getAttribute('calendar'): 'gregorian')
144
+                    ($child->hasAttribute('calendar') ? $child->getAttribute('calendar') : 'gregorian')
145 145
                 );
146 146
 
147 147
                 return new DateFollowUp(
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                     $this->getFree($child),
150 150
                     $day,
151 151
                     $child->getAttribute('followup'),
152
-                    ($child->hasAttribute('replaced')?explode(' ', $child->getAttribute('replaced')):[])
152
+                    ($child->hasAttribute('replaced') ?explode(' ', $child->getAttribute('replaced')) : [])
153 153
                 );
154 154
             case 'relative':
155 155
                 return new Relative(
Please login to merge, or discard this patch.
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
         return $iterator;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             default:
178 178
                 throw new RuntimeException('Unknown element encountered');
179 179
         }
180
-	}
180
+    }
181 181
 
182 182
     private function getFree(DOMElement $element): bool
183 183
     {
Please login to merge, or discard this patch.