@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $siteUrl = MetaValue::parseString($siteUrl); |
47 | 47 | // Extract out just the path part |
48 | 48 | $parts = self::decomposeUrl($path); |
49 | - $path = $parts['path'] . $parts['suffix']; |
|
49 | + $path = $parts['path'].$parts['suffix']; |
|
50 | 50 | $url = self::mergeUrlWithPath($siteUrl, $path); |
51 | 51 | // Handle trailing slashes properly for generated URLs |
52 | 52 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
53 | 53 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
54 | - $url = rtrim($url, '/') . '/'; |
|
54 | + $url = rtrim($url, '/').'/'; |
|
55 | 55 | } |
56 | 56 | if (!$generalConfig->addTrailingSlashesToUrls) { |
57 | 57 | $url = rtrim($url, '/'); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | public static function mergeUrlWithPath(string $url, string $path): string |
74 | 74 | { |
75 | 75 | $overlap = 0; |
76 | - $url = rtrim($url, '/') . '/'; |
|
77 | - $path = '/' . ltrim($path, '/'); |
|
76 | + $url = rtrim($url, '/').'/'; |
|
77 | + $path = '/'.ltrim($path, '/'); |
|
78 | 78 | $urlOffset = strlen($url); |
79 | 79 | $pathLength = strlen($path); |
80 | 80 | $pathOffset = 0; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/'); |
|
89 | + return rtrim($url, '/').'/'.ltrim(substr($path, $overlap), '/'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // Handle trailing slashes properly for generated URLs |
159 | 159 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
160 | 160 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
161 | - $url = rtrim($url, '/') . '/'; |
|
161 | + $url = rtrim($url, '/').'/'; |
|
162 | 162 | } |
163 | 163 | if (!$generalConfig->addTrailingSlashesToUrls && !$preserveTrailingSlash) { |
164 | 164 | $url = rtrim($url, '/'); |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | $urlParts = parse_url($url); |
179 | 179 | $encodedUrl = ""; |
180 | 180 | if (isset($urlParts['scheme'])) { |
181 | - $encodedUrl .= $urlParts['scheme'] . '://'; |
|
181 | + $encodedUrl .= $urlParts['scheme'].'://'; |
|
182 | 182 | } |
183 | 183 | if (isset($urlParts['host'])) { |
184 | 184 | $encodedUrl .= $urlParts['host']; |
185 | 185 | } |
186 | 186 | if (isset($urlParts['port'])) { |
187 | - $encodedUrl .= ':' . $urlParts['port']; |
|
187 | + $encodedUrl .= ':'.$urlParts['port']; |
|
188 | 188 | } |
189 | 189 | if (isset($urlParts['path'])) { |
190 | 190 | $encodedUrl .= $urlParts['path']; |
@@ -194,15 +194,15 @@ discard block |
||
194 | 194 | foreach ($query as $j => $value) { |
195 | 195 | $value = explode('=', $value, 2); |
196 | 196 | if (count($value) === 2) { |
197 | - $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]); |
|
197 | + $query[$j] = urlencode($value[0]).'='.urlencode($value[1]); |
|
198 | 198 | } else { |
199 | 199 | $query[$j] = urlencode($value[0]); |
200 | 200 | } |
201 | 201 | } |
202 | - $encodedUrl .= '?' . implode('&', $query); |
|
202 | + $encodedUrl .= '?'.implode('&', $query); |
|
203 | 203 | } |
204 | 204 | if (isset($urlParts['fragment'])) { |
205 | - $encodedUrl .= '#' . $urlParts['fragment']; |
|
205 | + $encodedUrl .= '#'.$urlParts['fragment']; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return $encodedUrl; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | if ($siteId !== null) { |
243 | 243 | $site = $sites->getSiteById($siteId, true); |
244 | 244 | if (!$site) { |
245 | - throw new Exception('Invalid site ID: ' . $siteId); |
|
245 | + throw new Exception('Invalid site ID: '.$siteId); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | |
267 | 267 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
268 | 268 | $url_parts = parse_url($pathOrUrl); |
269 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
269 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
270 | 270 | $result['path'] = $url_parts['path'] ?? ''; |
271 | 271 | $result['suffix'] = ''; |
272 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
273 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
272 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
273 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
274 | 274 | } else { |
275 | 275 | $result['prefix'] = ''; |
276 | 276 | $result['path'] = $pathOrUrl; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @var bool|array |
42 | 42 | */ |
43 | - protected array|bool|int $allowAnonymous = [ |
|
43 | + protected array | bool | int $allowAnonymous = [ |
|
44 | 44 | ]; |
45 | 45 | |
46 | 46 | // Public Methods |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function actionGenerate() |
66 | 66 | { |
67 | - echo 'This CLI command is no longer needed because of the paginated sitemap generation' . PHP_EOL; |
|
67 | + echo 'This CLI command is no longer needed because of the paginated sitemap generation'.PHP_EOL; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Protected Methods |