Passed
Push — develop ( f228ff...90ed2c )
by Andrew
20:04 queued 10:06
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'];
48
-            $url = rtrim($siteUrl, '/') . '/' . ltrim($path, '/');
47
+            $path = $parts['path'].$parts['suffix'];
48
+            $url = rtrim($siteUrl, '/').'/'.ltrim($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, '/');
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         // Handle trailing slashes properly for generated URLs
127 127
         $generalConfig = Craft::$app->getConfig()->getGeneral();
128 128
         if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/\.[^\/]+$/', $url)) {
129
-            $url = rtrim($url, '/') . '/';
129
+            $url = rtrim($url, '/').'/';
130 130
         }
131 131
         if (!$generalConfig->addTrailingSlashesToUrls) {
132 132
             $url = rtrim($url, '/');
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
         $urlParts = parse_url($url);
147 147
         $encodedUrl = "";
148 148
         if (isset($urlParts['scheme'])) {
149
-            $encodedUrl .= $urlParts['scheme'] . '://';
149
+            $encodedUrl .= $urlParts['scheme'].'://';
150 150
         }
151 151
         if (isset($urlParts['host'])) {
152 152
             $encodedUrl .= $urlParts['host'];
153 153
         }
154 154
         if (isset($urlParts['port'])) {
155
-            $encodedUrl .= ':' . $urlParts['port'];
155
+            $encodedUrl .= ':'.$urlParts['port'];
156 156
         }
157 157
         if (isset($urlParts['path'])) {
158 158
             $encodedUrl .= $urlParts['path'];
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
             foreach ($query as $j => $value) {
163 163
                 $value = explode('=', $value, 2);
164 164
                 if (count($value) === 2) {
165
-                    $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]);
165
+                    $query[$j] = urlencode($value[0]).'='.urlencode($value[1]);
166 166
                 } else {
167 167
                     $query[$j] = urlencode($value[0]);
168 168
                 }
169 169
             }
170
-            $encodedUrl .= '?' . implode('&', $query);
170
+            $encodedUrl .= '?'.implode('&', $query);
171 171
         }
172 172
         if (isset($urlParts['fragment'])) {
173
-            $encodedUrl .= '#' . $urlParts['fragment'];
173
+            $encodedUrl .= '#'.$urlParts['fragment'];
174 174
         }
175 175
 
176 176
         return $encodedUrl;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             if ($siteId !== null) {
211 211
                 $site = $sites->getSiteById($siteId, true);
212 212
                 if (!$site) {
213
-                    throw new Exception('Invalid site ID: ' . $siteId);
213
+                    throw new Exception('Invalid site ID: '.$siteId);
214 214
                 }
215 215
             }
216 216
 
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 
237 237
         if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) {
238 238
             $url_parts = parse_url($pathOrUrl);
239
-            $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host'];
239
+            $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host'];
240 240
             $result['path'] = $url_parts['path'] ?? '';
241 241
             $result['suffix'] = '';
242
-            $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query'];
243
-            $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment'];
242
+            $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query'];
243
+            $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment'];
244 244
         } else {
245 245
             $result['prefix'] = '';
246 246
             $result['path'] = $pathOrUrl;
Please login to merge, or discard this patch.