Passed
Push — develop ( a77457...e2fb5d )
by Andrew
28:46 queued 19:37
created
src/helpers/UrlHelper.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
             $siteUrl = MetaValue::parseString($siteUrl);
41 41
             // Extract out just the path part
42 42
             $parts = self::decomposeUrl($path);
43
-            $path = $parts['path'] . $parts['suffix'];
44
-            $url = rtrim($siteUrl, '/') . '/' . ltrim($path, '/');
43
+            $path = $parts['path'].$parts['suffix'];
44
+            $url = rtrim($siteUrl, '/').'/'.ltrim($path, '/');
45 45
             // Handle trailing slashes properly for generated URLs
46 46
             $generalConfig = Craft::$app->getConfig()->getGeneral();
47 47
             if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/\.[^\/]+$/', $url)) {
48
-                $url = rtrim($url, '/') . '/';
48
+                $url = rtrim($url, '/').'/';
49 49
             }
50 50
             if (!$generalConfig->addTrailingSlashesToUrls) {
51 51
                 $url = rtrim($url, '/');
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         // Handle trailing slashes properly for generated URLs
123 123
         $generalConfig = Craft::$app->getConfig()->getGeneral();
124 124
         if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/\.[^\/]+$/', $url)) {
125
-            $url = rtrim($url, '/') . '/';
125
+            $url = rtrim($url, '/').'/';
126 126
         }
127 127
         if (!$generalConfig->addTrailingSlashesToUrls) {
128 128
             $url = rtrim($url, '/');
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
         $urlParts = parse_url($url);
143 143
         $encodedUrl = "";
144 144
         if (isset($urlParts['scheme'])) {
145
-            $encodedUrl .= $urlParts['scheme'] . '://';
145
+            $encodedUrl .= $urlParts['scheme'].'://';
146 146
         }
147 147
         if (isset($urlParts['host'])) {
148 148
             $encodedUrl .= $urlParts['host'];
149 149
         }
150 150
         if (isset($urlParts['port'])) {
151
-            $encodedUrl .= ':' . $urlParts['port'];
151
+            $encodedUrl .= ':'.$urlParts['port'];
152 152
         }
153 153
         if (isset($urlParts['path'])) {
154 154
             $encodedUrl .= $urlParts['path'];
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
             foreach ($query as $j => $value) {
159 159
                 $value = explode('=', $value, 2);
160 160
                 if (count($value) === 2) {
161
-                    $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]);
161
+                    $query[$j] = urlencode($value[0]).'='.urlencode($value[1]);
162 162
                 } else {
163 163
                     $query[$j] = urlencode($value[0]);
164 164
                 }
165 165
             }
166
-            $encodedUrl .= '?' . implode('&', $query);
166
+            $encodedUrl .= '?'.implode('&', $query);
167 167
         }
168 168
         if (isset($urlParts['fragment'])) {
169
-            $encodedUrl .= '#' . $urlParts['fragment'];
169
+            $encodedUrl .= '#'.$urlParts['fragment'];
170 170
         }
171 171
 
172 172
         return $encodedUrl;
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 
200 200
         if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) {
201 201
             $url_parts = parse_url($pathOrUrl);
202
-            $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host'];
202
+            $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host'];
203 203
             $result['path'] = $url_parts['path'] ?? '';
204 204
             $result['suffix'] = '';
205
-            $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query'];
206
-            $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment'];
205
+            $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query'];
206
+            $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment'];
207 207
         } else {
208 208
             $result['prefix'] = '';
209 209
             $result['path'] = $pathOrUrl;
Please login to merge, or discard this patch.