Passed
Push — master ( ba00c7...bfa3fc )
by Sebastian
08:42
created
src/URLInfo/URIParser.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
         $result = parse_url($this->url);
111 111
         $this->info = array();
112 112
 
113
-        if(!is_array($result))
113
+        if (!is_array($result))
114 114
         {
115 115
             $this->fixBrokenURL();
116 116
             $result = parse_url($this->url);
117 117
         }
118 118
 
119
-        if(is_array($result))
119
+        if (is_array($result))
120 120
         {
121 121
             $this->info = $result;
122 122
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         // if the URL contains any URL characters, and we
127 127
         // do not want them URL encoded, restore them.
128
-        if(!$this->encodeUTF && !empty($this->unicodeChars))
128
+        if (!$this->encodeUTF && !empty($this->unicodeChars))
129 129
         {
130 130
             $this->info = $this->restoreUnicodeChars($this->info);
131 131
         }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     private function fixBrokenURL() : void
139 139
     {
140
-        if(strpos($this->url, ':') === false) {
140
+        if (strpos($this->url, ':') === false) {
141 141
             return;
142 142
         }
143 143
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         // else, as unlikely as it may be.
146 146
         $parts = explode(':', $this->url);
147 147
 
148
-        while(strpos($parts[1], '///') === 0)
148
+        while (strpos($parts[1], '///') === 0)
149 149
         {
150 150
             $parts[1] = str_replace('///', '//', $parts[1]);
151 151
         }
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
         
165 165
         $keep = array();
166 166
         
167
-        foreach($chars as $char)
167
+        foreach ($chars as $char)
168 168
         {
169
-            if(preg_match('/\p{L}/uix', $char))
169
+            if (preg_match('/\p{L}/uix', $char))
170 170
             {
171 171
                 $encoded = rawurlencode($char);
172 172
                 
173
-                if($encoded !== $char)
173
+                if ($encoded !== $char)
174 174
                 {
175 175
                     $this->unicodeChars[$encoded] = $char;
176 176
                     $char = $encoded;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
     protected function detectType() : bool
187 187
     {
188
-        foreach(self::$detectorClasses as $className)
188
+        foreach (self::$detectorClasses as $className)
189 189
         {
190 190
             $detector = ClassHelper::requireObjectInstanceOf(
191 191
                 BaseURLTypeDetector::class,
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             // Use the adjusted data
198 198
             $this->info = $detector->getInfo();
199 199
 
200
-            if($detected) {
200
+            if ($detected) {
201 201
                 $this->isValid = true;
202 202
                 return true;
203 203
             }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
     protected function validate() : void
210 210
     {
211
-        foreach(self::$validatorClasses as $validatorClass)
211
+        foreach (self::$validatorClasses as $validatorClass)
212 212
         {
213 213
             $validator = ClassHelper::requireObjectInstanceOf(
214 214
                 BaseURLValidator::class,
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
             $this->info = $validator->getInfo();
221 221
 
222
-            if($result !== true) {
222
+            if ($result !== true) {
223 223
                 $this->isValid = false;
224 224
                 return;
225 225
             }
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
     {
250 250
         $result = array();
251 251
         
252
-        foreach($subject as $key => $val)
252
+        foreach ($subject as $key => $val)
253 253
         {
254
-            if(is_array($val))
254
+            if (is_array($val))
255 255
             {
256 256
                 $val = $this->restoreUnicodeChars($val);
257 257
             }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     */
278 278
     protected function restoreUnicodeChar(string $string) : string
279 279
     {
280
-        if(strpos($string, '%') !== false)
280
+        if (strpos($string, '%') !== false)
281 281
         {
282 282
             return str_replace(array_keys($this->unicodeChars), array_values($this->unicodeChars), $string);
283 283
         }
Please login to merge, or discard this patch.