Passed
Push — master ( 4f2521...71e747 )
by Pouya
01:33
created
src/ConvertToAbsolutePath.php 1 patch
Braces   +25 added lines, -19 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $parseUrl = parse_url($url);
112 112
         if ($this->isCorrectUrl($parseUrl)) {
113 113
             return '';
114
-        }elseif(isset($parseUrl['scheme'])){
114
+        } elseif(isset($parseUrl['scheme'])){
115 115
             return $parseUrl['scheme'] . '://' . $parseUrl['host'];
116 116
         } else {
117 117
             return $parseUrl['host'];
@@ -123,8 +123,9 @@  discard block
 block discarded – undo
123 123
     public function upToLastDir($url) {
124 124
         $parseUrl = parse_url($url);
125 125
         $path = '';
126
-        if(isset($parseUrl['path']))
127
-            $path = preg_replace('/\/([^\/]+)$/i', '', $parseUrl['path']);
126
+        if(isset($parseUrl['path'])) {
127
+                    $path = preg_replace('/\/([^\/]+)$/i', '', $parseUrl['path']);
128
+        }
128 129
         return rtrim($parseUrl['scheme'] . '://' . $parseUrl['host'] . $path, '/') . '/';
129 130
     }
130 131
 
@@ -164,9 +165,9 @@  discard block
 block discarded – undo
164 165
         if($this->starterPath===null){
165 166
             if($this->getBaseTag() === null) {
166 167
                 $this->starterPath =$this->getPagePath();
167
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
168
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
168 169
                 $this->starterPath = $this->getBaseTag() ;
169
-            }else{
170
+            } else{
170 171
                 $this->starterPath = $this->getPagePathParsing()['scheme'] . '://' . $this->getPagePathParsing()['host'] . $this->getBaseTag();
171 172
             }
172 173
         }
@@ -178,9 +179,9 @@  discard block
 block discarded – undo
178 179
         if ($this->domain === null) {
179 180
             if($this->getBaseTag() === null) {
180 181
                 $this->domain = $this->getPagePathParsing()['host'] . '/';
181
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
182
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
182 183
                 $this->domain = $this->getBaseTagParsing()['host'] . '/';
183
-            }else{
184
+            } else{
184 185
                 $this->domain = $this->getPagePathParsing()['host'] . '/';
185 186
             }
186 187
         }
@@ -192,9 +193,9 @@  discard block
 block discarded – undo
192 193
         if ($this->scheme === null) {
193 194
             if($this->getBaseTag() === null) {
194 195
                 $this->scheme = $this->getPagePathParsing()['scheme'];
195
-            }elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
196
+            } elseif(array_key_exists('scheme', $this->getBaseTagParsing())){
196 197
                 $this->scheme = $this->getBaseTagParsing()['scheme'];
197
-            }else{
198
+            } else{
198 199
                 $this->scheme = $this->getPagePathParsing()['scheme'];
199 200
             }
200 201
         }
@@ -203,15 +204,17 @@  discard block
 block discarded – undo
203 204
 
204 205
     public function getBaseTagParsing()
205 206
     {
206
-        if($this->baseTagParsing == null)
207
-            $this->baseTagParsing = parse_url($this->getBaseTag());
207
+        if($this->baseTagParsing == null) {
208
+                    $this->baseTagParsing = parse_url($this->getBaseTag());
209
+        }
208 210
         return $this->baseTagParsing;
209 211
     }
210 212
 
211 213
     public function getPagePathParsing()
212 214
     {
213
-        if($this->pagePathParsing == null)
214
-            $this->pagePathParsing = parse_url($this->getPagePath());
215
+        if($this->pagePathParsing == null) {
216
+                    $this->pagePathParsing = parse_url($this->getPagePath());
217
+        }
215 218
         return $this->pagePathParsing;
216 219
     }
217 220
 
@@ -239,12 +242,15 @@  discard block
 block discarded – undo
239 242
      */
240 243
     public function checkPathIsAbsoluteOrForAnotherApp($path): string
241 244
     {
242
-        if (preg_match('/services:\/\//i', $path))
243
-            return '';
244
-        if (preg_match('/whatsapp:\/\//i', $path))
245
-            return '';
246
-        if (preg_match('/tel:/i', $path))
247
-            return '';
245
+        if (preg_match('/services:\/\//i', $path)) {
246
+                    return '';
247
+        }
248
+        if (preg_match('/whatsapp:\/\//i', $path)) {
249
+                    return '';
250
+        }
251
+        if (preg_match('/tel:/i', $path)) {
252
+                    return '';
253
+        }
248 254
         return $path;
249 255
     }
250 256
 
Please login to merge, or discard this patch.