Passed
Push — master ( 526e5d...00c05c )
by Pouya
01:28
created
src/ConvertToAbsolutePath.php 1 patch
Braces   +25 added lines, -19 removed lines patch added patch discarded remove patch
@@ -70,12 +70,15 @@  discard block
 block discarded – undo
70 70
     {
71 71
         // Skip converting if the relative url like http://... or android-app://... etc.
72 72
         if (preg_match('/[a-z0-9-]{1,}(:\/\/)/i', $path)) {
73
-            if(preg_match('/services:\/\//i', $path))
74
-                return '';
75
-            if(preg_match('/whatsapp:\/\//i', $path))
76
-                return '';
77
-            if(preg_match('/tel:/i', $path))
78
-                return '';
73
+            if(preg_match('/services:\/\//i', $path)) {
74
+                            return '';
75
+            }
76
+            if(preg_match('/whatsapp:\/\//i', $path)) {
77
+                            return '';
78
+            }
79
+            if(preg_match('/tel:/i', $path)) {
80
+                            return '';
81
+            }
79 82
             return $path;
80 83
         }
81 84
         // Treat path as invalid if it is like javascript:... etc.
@@ -127,7 +130,7 @@  discard block
 block discarded – undo
127 130
         $parseUrl = parse_url($url);
128 131
         if (!isset($parseUrl['scheme']) AND !isset($parseUrl['host'])) {
129 132
             return '';
130
-        }elseif(isset($parseUrl['scheme'])){
133
+        } elseif(isset($parseUrl['scheme'])){
131 134
             return $parseUrl['scheme'] . '://' . $parseUrl['host'];
132 135
         } else {
133 136
             return $parseUrl['host'];
@@ -139,8 +142,9 @@  discard block
 block discarded – undo
139 142
     public function upToLastDir($url) {
140 143
         $parseUrl = parse_url($url);
141 144
         $path = '';
142
-        if(isset($parseUrl['path']))
143
-            $path = preg_replace('/\/([^\/]+)$/i', '', $parseUrl['path']);
145
+        if(isset($parseUrl['path'])) {
146
+                    $path = preg_replace('/\/([^\/]+)$/i', '', $parseUrl['path']);
147
+        }
144 148
         return rtrim($parseUrl['scheme'] . '://' . $parseUrl['host'] . $path, '/') . '/';
145 149
     }
146 150
 
@@ -180,9 +184,9 @@  discard block
 block discarded – undo
180 184
         if($this->starterPath===null){
181 185
             if($this->getBaseTag() === null) {
182 186
                 $this->starterPath =$this->getPagePath();
183
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
187
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
184 188
                 $this->starterPath = $this->getBaseTag() ;
185
-            }else{
189
+            } else{
186 190
                 $this->starterPath = $this->getPagePathParsing()['scheme'] . '://' . $this->getPagePathParsing()['host'] . $this->getBaseTag();
187 191
             }
188 192
         }
@@ -194,9 +198,9 @@  discard block
 block discarded – undo
194 198
         if ($this->domain === null) {
195 199
             if($this->getBaseTag() === null) {
196 200
                 $this->domain = $this->getPagePathParsing()['host'] . '/';
197
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
201
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
198 202
                 $this->domain = $this->getBaseTagParsing()['host'] . '/';
199
-            }else{
203
+            } else{
200 204
                 $this->domain = $this->getPagePathParsing()['host'] . '/';
201 205
             }
202 206
         }
@@ -208,9 +212,9 @@  discard block
 block discarded – undo
208 212
         if ($this->scheme === null) {
209 213
             if($this->getBaseTag() === null) {
210 214
                 $this->scheme = $this->getPagePathParsing()['scheme'];
211
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
215
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
212 216
                 $this->scheme = $this->getBaseTagParsing()['scheme'];
213
-            }else{
217
+            } else{
214 218
                 $this->scheme = $this->getPagePathParsing()['scheme'];
215 219
             }
216 220
         }
@@ -219,15 +223,17 @@  discard block
 block discarded – undo
219 223
 
220 224
     private function getBaseTagParsing()
221 225
     {
222
-        if($this->baseTagParsing == null)
223
-            $this->baseTagParsing = parse_url($this->getBaseTag());
226
+        if($this->baseTagParsing == null) {
227
+                    $this->baseTagParsing = parse_url($this->getBaseTag());
228
+        }
224 229
         return $this->baseTagParsing;
225 230
     }
226 231
 
227 232
     private function getPagePathParsing()
228 233
     {
229
-        if($this->pagePathParsing == null)
230
-            $this->pagePathParsing = parse_url($this->getPagePath());
234
+        if($this->pagePathParsing == null) {
235
+                    $this->pagePathParsing = parse_url($this->getPagePath());
236
+        }
231 237
         return $this->pagePathParsing;
232 238
     }
233 239
 }
234 240
\ No newline at end of file
Please login to merge, or discard this patch.