Passed
Push — develop ( 355eb3...3768ab )
by Andrew
18:27 queued 09:29
created
src/helpers/UrlHelper.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
             $siteUrl = MetaValue::parseString($siteUrl);
45 45
             // Extract out just the path part
46 46
             $parts = self::decomposeUrl($path);
47
-            $path = $parts['path'] . $parts['suffix'];
47
+            $path = $parts['path'].$parts['suffix'];
48 48
             $url = self::mergeUrlWithPath($siteUrl, $path);
49 49
             // Handle trailing slashes properly for generated URLs
50 50
             $generalConfig = Craft::$app->getConfig()->getGeneral();
51 51
             if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/\.[^\/]+$/', $url)) {
52
-                $url = rtrim($url, '/') . '/';
52
+                $url = rtrim($url, '/').'/';
53 53
             }
54 54
             if (!$generalConfig->addTrailingSlashesToUrls) {
55 55
                 $url = rtrim($url, '/');
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             }
83 83
         }
84 84
 
85
-        return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/');
85
+        return rtrim($url, '/').'/'.ltrim(substr($path, $overlap), '/');
86 86
     }
87 87
 
88 88
     /**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         // Handle trailing slashes properly for generated URLs
151 151
         $generalConfig = Craft::$app->getConfig()->getGeneral();
152 152
         if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/\.[^\/]+$/', $url)) {
153
-            $url = rtrim($url, '/') . '/';
153
+            $url = rtrim($url, '/').'/';
154 154
         }
155 155
         if (!$generalConfig->addTrailingSlashesToUrls) {
156 156
             $url = rtrim($url, '/');
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
         $urlParts = parse_url($url);
171 171
         $encodedUrl = "";
172 172
         if (isset($urlParts['scheme'])) {
173
-            $encodedUrl .= $urlParts['scheme'] . '://';
173
+            $encodedUrl .= $urlParts['scheme'].'://';
174 174
         }
175 175
         if (isset($urlParts['host'])) {
176 176
             $encodedUrl .= $urlParts['host'];
177 177
         }
178 178
         if (isset($urlParts['port'])) {
179
-            $encodedUrl .= ':' . $urlParts['port'];
179
+            $encodedUrl .= ':'.$urlParts['port'];
180 180
         }
181 181
         if (isset($urlParts['path'])) {
182 182
             $encodedUrl .= $urlParts['path'];
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
             foreach ($query as $j => $value) {
187 187
                 $value = explode('=', $value, 2);
188 188
                 if (count($value) === 2) {
189
-                    $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]);
189
+                    $query[$j] = urlencode($value[0]).'='.urlencode($value[1]);
190 190
                 } else {
191 191
                     $query[$j] = urlencode($value[0]);
192 192
                 }
193 193
             }
194
-            $encodedUrl .= '?' . implode('&', $query);
194
+            $encodedUrl .= '?'.implode('&', $query);
195 195
         }
196 196
         if (isset($urlParts['fragment'])) {
197
-            $encodedUrl .= '#' . $urlParts['fragment'];
197
+            $encodedUrl .= '#'.$urlParts['fragment'];
198 198
         }
199 199
 
200 200
         return $encodedUrl;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             if ($siteId !== null) {
235 235
                 $site = $sites->getSiteById($siteId, true);
236 236
                 if (!$site) {
237
-                    throw new Exception('Invalid site ID: ' . $siteId);
237
+                    throw new Exception('Invalid site ID: '.$siteId);
238 238
                 }
239 239
             }
240 240
 
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 
261 261
         if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) {
262 262
             $url_parts = parse_url($pathOrUrl);
263
-            $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host'];
263
+            $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host'];
264 264
             $result['path'] = $url_parts['path'] ?? '';
265 265
             $result['suffix'] = '';
266
-            $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query'];
267
-            $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment'];
266
+            $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query'];
267
+            $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment'];
268 268
         } else {
269 269
             $result['prefix'] = '';
270 270
             $result['path'] = $pathOrUrl;
Please login to merge, or discard this patch.