Passed
Push — master ( 00c05c...4f2521 )
by Pouya
01:17
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.
@@ -117,7 +120,7 @@  discard block
 block discarded – undo
117 120
         $parseUrl = parse_url($url);
118 121
         if ($this->isCorrectUrl($parseUrl)) {
119 122
             return '';
120
-        }elseif(isset($parseUrl['scheme'])){
123
+        } elseif(isset($parseUrl['scheme'])){
121 124
             return $parseUrl['scheme'] . '://' . $parseUrl['host'];
122 125
         } else {
123 126
             return $parseUrl['host'];
@@ -129,8 +132,9 @@  discard block
 block discarded – undo
129 132
     public function upToLastDir($url) {
130 133
         $parseUrl = parse_url($url);
131 134
         $path = '';
132
-        if(isset($parseUrl['path']))
133
-            $path = preg_replace('/\/([^\/]+)$/i', '', $parseUrl['path']);
135
+        if(isset($parseUrl['path'])) {
136
+                    $path = preg_replace('/\/([^\/]+)$/i', '', $parseUrl['path']);
137
+        }
134 138
         return rtrim($parseUrl['scheme'] . '://' . $parseUrl['host'] . $path, '/') . '/';
135 139
     }
136 140
 
@@ -170,9 +174,9 @@  discard block
 block discarded – undo
170 174
         if($this->starterPath===null){
171 175
             if($this->getBaseTag() === null) {
172 176
                 $this->starterPath =$this->getPagePath();
173
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
177
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
174 178
                 $this->starterPath = $this->getBaseTag() ;
175
-            }else{
179
+            } else{
176 180
                 $this->starterPath = $this->getPagePathParsing()['scheme'] . '://' . $this->getPagePathParsing()['host'] . $this->getBaseTag();
177 181
             }
178 182
         }
@@ -184,9 +188,9 @@  discard block
 block discarded – undo
184 188
         if ($this->domain === null) {
185 189
             if($this->getBaseTag() === null) {
186 190
                 $this->domain = $this->getPagePathParsing()['host'] . '/';
187
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
191
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
188 192
                 $this->domain = $this->getBaseTagParsing()['host'] . '/';
189
-            }else{
193
+            } else{
190 194
                 $this->domain = $this->getPagePathParsing()['host'] . '/';
191 195
             }
192 196
         }
@@ -198,9 +202,9 @@  discard block
 block discarded – undo
198 202
         if ($this->scheme === null) {
199 203
             if($this->getBaseTag() === null) {
200 204
                 $this->scheme = $this->getPagePathParsing()['scheme'];
201
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
205
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
202 206
                 $this->scheme = $this->getBaseTagParsing()['scheme'];
203
-            }else{
207
+            } else{
204 208
                 $this->scheme = $this->getPagePathParsing()['scheme'];
205 209
             }
206 210
         }
@@ -209,15 +213,17 @@  discard block
 block discarded – undo
209 213
 
210 214
     public function getBaseTagParsing()
211 215
     {
212
-        if($this->baseTagParsing == null)
213
-            $this->baseTagParsing = parse_url($this->getBaseTag());
216
+        if($this->baseTagParsing == null) {
217
+                    $this->baseTagParsing = parse_url($this->getBaseTag());
218
+        }
214 219
         return $this->baseTagParsing;
215 220
     }
216 221
 
217 222
     public function getPagePathParsing()
218 223
     {
219
-        if($this->pagePathParsing == null)
220
-            $this->pagePathParsing = parse_url($this->getPagePath());
224
+        if($this->pagePathParsing == null) {
225
+                    $this->pagePathParsing = parse_url($this->getPagePath());
226
+        }
221 227
         return $this->pagePathParsing;
222 228
     }
223 229
 
Please login to merge, or discard this patch.