Passed
Push — v3 ( d897ff...8a04fd )
by Andrew
20:30 queued 15s
created
src/models/SitemapTemplate.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
         }
141 141
 
142 142
         $cache = Craft::$app->getCache();
143
-        $pageCacheSuffix = 's' . (int)$metaBundle->metaSitemapVars->sitemapPageSize . 'p' . $page;
143
+        $pageCacheSuffix = 's'.(int) $metaBundle->metaSitemapVars->sitemapPageSize.'p'.$page;
144 144
 
145
-        $uniqueKey = $groupId . $type . $handle . $siteId . $pageCacheSuffix;
146
-        $cacheKey = self::CACHE_KEY . $uniqueKey;
145
+        $uniqueKey = $groupId.$type.$handle.$siteId.$pageCacheSuffix;
146
+        $cacheKey = self::CACHE_KEY.$uniqueKey;
147 147
         $result = $cache->get($cacheKey);
148 148
 
149 149
         // If the sitemap isn't cached, render it immediately
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
                 $dependency = new TagDependency([
161 161
                     'tags' => [
162 162
                         self::GLOBAL_SITEMAP_CACHE_TAG,
163
-                        self::SITEMAP_CACHE_TAG . $handle . $siteId,
164
-                        self::SITEMAP_CACHE_TAG . $handle . $siteId . $pageCacheSuffix,
163
+                        self::SITEMAP_CACHE_TAG.$handle.$siteId,
164
+                        self::SITEMAP_CACHE_TAG.$handle.$siteId.$pageCacheSuffix,
165 165
                     ],
166 166
                 ]);
167 167
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
                 // Output some info if this is a console app
175 175
                 if (Craft::$app instanceof ConsoleApplication) {
176
-                    echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL;
176
+                    echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL;
177 177
                 }
178 178
 
179 179
                 // If the FastCGI Cache Bust plugin is installed, clear its caches too
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             }
188 188
         } else {
189 189
             if (Craft::$app instanceof ConsoleApplication) {
190
-                echo 'Found in cache' . PHP_EOL;
190
+                echo 'Found in cache'.PHP_EOL;
191 191
             }
192 192
         }
193 193
 
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
     public function invalidateCache(string $handle, int $siteId)
204 204
     {
205 205
         $cache = Craft::$app->getCache();
206
-        TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId);
206
+        TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId);
207 207
         Craft::info(
208
-            'Sitemap cache cleared: ' . $handle,
208
+            'Sitemap cache cleared: '.$handle,
209 209
             __METHOD__
210 210
         );
211 211
     }
Please login to merge, or discard this patch.
src/helpers/UrlHelper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         // Handle trailing slashes properly for generated URLs
155 155
         $generalConfig = Craft::$app->getConfig()->getGeneral();
156 156
         if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) {
157
-            $url = rtrim($url, '/') . '/';
157
+            $url = rtrim($url, '/').'/';
158 158
         }
159 159
         if (!$generalConfig->addTrailingSlashesToUrls) {
160 160
             $url = rtrim($url, '/');
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
         $urlParts = parse_url($url);
175 175
         $encodedUrl = "";
176 176
         if (isset($urlParts['scheme'])) {
177
-            $encodedUrl .= $urlParts['scheme'] . '://';
177
+            $encodedUrl .= $urlParts['scheme'].'://';
178 178
         }
179 179
         if (isset($urlParts['host'])) {
180 180
             $encodedUrl .= $urlParts['host'];
181 181
         }
182 182
         if (isset($urlParts['port'])) {
183
-            $encodedUrl .= ':' . $urlParts['port'];
183
+            $encodedUrl .= ':'.$urlParts['port'];
184 184
         }
185 185
         if (isset($urlParts['path'])) {
186 186
             $encodedUrl .= $urlParts['path'];
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
             foreach ($query as $j => $value) {
191 191
                 $value = explode('=', $value, 2);
192 192
                 if (count($value) === 2) {
193
-                    $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]);
193
+                    $query[$j] = urlencode($value[0]).'='.urlencode($value[1]);
194 194
                 } else {
195 195
                     $query[$j] = urlencode($value[0]);
196 196
                 }
197 197
             }
198
-            $encodedUrl .= '?' . implode('&', $query);
198
+            $encodedUrl .= '?'.implode('&', $query);
199 199
         }
200 200
         if (isset($urlParts['fragment'])) {
201
-            $encodedUrl .= '#' . $urlParts['fragment'];
201
+            $encodedUrl .= '#'.$urlParts['fragment'];
202 202
         }
203 203
 
204 204
         return $encodedUrl;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             if ($siteId !== null) {
239 239
                 $site = $sites->getSiteById($siteId, true);
240 240
                 if (!$site) {
241
-                    throw new Exception('Invalid site ID: ' . $siteId);
241
+                    throw new Exception('Invalid site ID: '.$siteId);
242 242
                 }
243 243
             }
244 244
 
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 
263 263
         if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) {
264 264
             $url_parts = parse_url($pathOrUrl);
265
-            $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host'];
265
+            $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host'];
266 266
             $result['path'] = $url_parts['path'] ?? '';
267 267
             $result['suffix'] = '';
268
-            $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query'];
269
-            $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment'];
268
+            $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query'];
269
+            $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment'];
270 270
         } else {
271 271
             $result['prefix'] = '';
272 272
             $result['path'] = $pathOrUrl;
Please login to merge, or discard this patch.