Passed
Push — v4 ( b00655...3a3894 )
by Andrew
44:46 queued 20:25
created
src/models/SitemapTemplate.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
         }
150 150
 
151 151
         $cache = Craft::$app->getCache();
152
-        $pageCacheSuffix = 's' . (int)$metaBundle->metaSitemapVars->sitemapPageSize . 'p' . $page;
152
+        $pageCacheSuffix = 's'.(int) $metaBundle->metaSitemapVars->sitemapPageSize.'p'.$page;
153 153
 
154
-        $uniqueKey = $groupId . $type . $handle . $siteId . $pageCacheSuffix;
155
-        $cacheKey = self::CACHE_KEY . $uniqueKey;
154
+        $uniqueKey = $groupId.$type.$handle.$siteId.$pageCacheSuffix;
155
+        $cacheKey = self::CACHE_KEY.$uniqueKey;
156 156
         $result = $cache->get($cacheKey);
157 157
 
158 158
         // If the sitemap isn't cached, start a job to create it
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
                 $dependency = new TagDependency([
172 172
                     'tags' => [
173 173
                         self::GLOBAL_SITEMAP_CACHE_TAG,
174
-                        self::SITEMAP_CACHE_TAG . $handle . $siteId,
175
-                        self::SITEMAP_CACHE_TAG . $handle . $siteId . $pageCacheSuffix,
174
+                        self::SITEMAP_CACHE_TAG.$handle.$siteId,
175
+                        self::SITEMAP_CACHE_TAG.$handle.$siteId.$pageCacheSuffix,
176 176
                     ],
177 177
                 ]);
178 178
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
                 // Output some info if this is a console app
186 186
                 if (Craft::$app instanceof ConsoleApplication) {
187
-                    echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL;
187
+                    echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL;
188 188
                 }
189 189
 
190 190
                 // If the FastCGI Cache Bust plugin is installed, clear its caches too
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
                 // Return an empty XML document
213 213
                 $lines[] = '<?xml version="1.0" encoding="UTF-8"?>';
214 214
                 $lines[] = '<?xml-stylesheet type="text/xsl" href="sitemap-empty.xsl"?>';
215
-                $lines[] = '<!-- ' . Craft::t('seomatic', 'This sitemap has not been generated yet.') . ' -->';
216
-                $lines[] = '<!-- ' . Craft::t('seomatic', 'If you are seeing this in local dev or an') . ' -->';
217
-                $lines[] = '<!-- ' . Craft::t('seomatic', 'environment with `devMode` on, caches only') . ' -->';
218
-                $lines[] = '<!-- ' . Craft::t('seomatic', 'last for 30 seconds in local dev, so it is') . ' -->';
219
-                $lines[] = '<!-- ' . Craft::t('seomatic', 'normal for the sitemap to not be cached.') . ' -->';
215
+                $lines[] = '<!-- '.Craft::t('seomatic', 'This sitemap has not been generated yet.').' -->';
216
+                $lines[] = '<!-- '.Craft::t('seomatic', 'If you are seeing this in local dev or an').' -->';
217
+                $lines[] = '<!-- '.Craft::t('seomatic', 'environment with `devMode` on, caches only').' -->';
218
+                $lines[] = '<!-- '.Craft::t('seomatic', 'last for 30 seconds in local dev, so it is').' -->';
219
+                $lines[] = '<!-- '.Craft::t('seomatic', 'normal for the sitemap to not be cached.').' -->';
220 220
                 $lines[] = '<urlset>';
221 221
                 $lines[] = '</urlset>';
222 222
             }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             return $lines;
226 226
         } else {
227 227
             if (Craft::$app instanceof ConsoleApplication) {
228
-                echo 'Found in cache' . PHP_EOL;
228
+                echo 'Found in cache'.PHP_EOL;
229 229
             }
230 230
         }
231 231
 
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
     public function invalidateCache(string $handle, int $siteId)
242 242
     {
243 243
         $cache = Craft::$app->getCache();
244
-        TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId);
244
+        TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId);
245 245
         Craft::info(
246
-            'Sitemap cache cleared: ' . $handle,
246
+            'Sitemap cache cleared: '.$handle,
247 247
             __METHOD__
248 248
         );
249 249
     }
Please login to merge, or discard this patch.
src/services/Sitemaps.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
     // Constants
44 44
     // =========================================================================
45 45
 
46
-    public const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapIndexTemplate::TEMPLATE_TYPE;
46
+    public const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapIndexTemplate::TEMPLATE_TYPE;
47 47
 
48
-    public const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapTemplate::TEMPLATE_TYPE;
48
+    public const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapTemplate::TEMPLATE_TYPE;
49 49
 
50
-    public const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapCustomTemplate::TEMPLATE_TYPE;
50
+    public const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapCustomTemplate::TEMPLATE_TYPE;
51 51
 
52 52
     public const SEARCH_ENGINE_SUBMISSION_URLS = [
53 53
     ];
@@ -238,19 +238,19 @@  discard block
 block discarded – undo
238 238
                         $siteId = $groupSiteIds[0];
239 239
                         $sitemapIndexUrl = $this->sitemapIndexUrlForSiteId($siteId);
240 240
                         if (!empty($sitemapIndexUrl)) {
241
-                            $submissionUrl = $url . urlencode($sitemapIndexUrl);
241
+                            $submissionUrl = $url.urlencode($sitemapIndexUrl);
242 242
                             // create new guzzle client
243 243
                             $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]);
244 244
                             // Submit the sitemap index to each search engine
245 245
                             try {
246 246
                                 $guzzleClient->post($submissionUrl);
247 247
                                 Craft::info(
248
-                                    'Sitemap index submitted to: ' . $submissionUrl,
248
+                                    'Sitemap index submitted to: '.$submissionUrl,
249 249
                                     __METHOD__
250 250
                                 );
251 251
                             } catch (\Exception $e) {
252 252
                                 Craft::error(
253
-                                    'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(),
253
+                                    'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(),
254 254
                                     __METHOD__
255 255
                                 );
256 256
                             }
@@ -312,19 +312,19 @@  discard block
 block discarded – undo
312 312
             foreach ($searchEngineUrls as &$url) {
313 313
                 $sitemapUrl = $this->sitemapUrlForBundle($sourceBundleType, $sourceHandle, $sourceSiteId);
314 314
                 if (!empty($sitemapUrl)) {
315
-                    $submissionUrl = $url . urlencode($sitemapUrl);
315
+                    $submissionUrl = $url.urlencode($sitemapUrl);
316 316
                     // create new guzzle client
317 317
                     $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]);
318 318
                     // Submit the sitemap index to each search engine
319 319
                     try {
320 320
                         $guzzleClient->post($submissionUrl);
321 321
                         Craft::info(
322
-                            'Sitemap index submitted to: ' . $submissionUrl,
322
+                            'Sitemap index submitted to: '.$submissionUrl,
323 323
                             __METHOD__
324 324
                         );
325 325
                     } catch (\Exception $e) {
326 326
                         Craft::error(
327
-                            'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(),
327
+                            'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(),
328 328
                             __METHOD__
329 329
                         );
330 330
                     }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                     . '-'
366 366
                     . $metaBundle->sourceSiteId
367 367
                     . '-sitemap'
368
-                    . (!empty($page) ? '-p' . $page : '')
368
+                    . (!empty($page) ? '-p'.$page : '')
369 369
                     . '.xml',
370 370
                     null,
371 371
                     null,
@@ -394,19 +394,19 @@  discard block
 block discarded – undo
394 394
             foreach ($searchEngineUrls as &$url) {
395 395
                 $sitemapUrl = $this->sitemapCustomUrlForSiteId($siteId);
396 396
                 if (!empty($sitemapUrl)) {
397
-                    $submissionUrl = $url . urlencode($sitemapUrl);
397
+                    $submissionUrl = $url.urlencode($sitemapUrl);
398 398
                     // create new guzzle client
399 399
                     $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]);
400 400
                     // Submit the sitemap index to each search engine
401 401
                     try {
402 402
                         $guzzleClient->post($submissionUrl);
403 403
                         Craft::info(
404
-                            'Sitemap Custom submitted to: ' . $submissionUrl,
404
+                            'Sitemap Custom submitted to: '.$submissionUrl,
405 405
                             __METHOD__
406 406
                         );
407 407
                     } catch (\Exception $e) {
408 408
                         Craft::error(
409
-                            'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(),
409
+                            'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(),
410 410
                             __METHOD__
411 411
                         );
412 412
                     }
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
         }
485 485
 
486 486
         foreach ($sites as $site) {
487
-            $result .= 'sitemap: ' . $this->sitemapIndexUrlForSiteId($site->id) . PHP_EOL;
487
+            $result .= 'sitemap: '.$this->sitemapIndexUrlForSiteId($site->id).PHP_EOL;
488 488
         }
489 489
 
490 490
         return rtrim($result, PHP_EOL);
@@ -515,9 +515,9 @@  discard block
 block discarded – undo
515 515
     {
516 516
         // Always just invalidate the sitemap cache now, since we're doing paginated sitemaps
517 517
         $cache = Craft::$app->getCache();
518
-        TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId);
518
+        TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId);
519 519
         Craft::info(
520
-            'Sitemap cache cleared: ' . $handle,
520
+            'Sitemap cache cleared: '.$handle,
521 521
             __METHOD__
522 522
         );
523 523
     }
Please login to merge, or discard this patch.
src/services/MetaContainers.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         // Get the page number of this request
183 183
         $request = Craft::$app->getRequest();
184 184
         if (!$request->isConsoleRequest) {
185
-            $this->paginationPage = (string)$request->pageNum;
185
+            $this->paginationPage = (string) $request->pageNum;
186 186
         }
187 187
     }
188 188
 
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
         $dependency = $this->containerDependency;
252 252
         $uniqueKey = $dependency->tags[3] ?? self::GLOBALS_CACHE_KEY;
253 253
         list($this->metaGlobalVars, $this->metaSiteVars) = Craft::$app->getCache()->getOrSet(
254
-            self::GLOBALS_CACHE_KEY . $uniqueKey,
254
+            self::GLOBALS_CACHE_KEY.$uniqueKey,
255 255
             function() use ($uniqueKey) {
256 256
                 Craft::info(
257
-                    self::GLOBALS_CACHE_KEY . ' cache miss: ' . $uniqueKey,
257
+                    self::GLOBALS_CACHE_KEY.' cache miss: '.$uniqueKey,
258 258
                     __METHOD__
259 259
                 );
260 260
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                     ?? 1;
381 381
             }
382 382
             // Handle pagination
383
-            $paginationPage = 'page' . $this->paginationPage;
383
+            $paginationPage = 'page'.$this->paginationPage;
384 384
             // Get the path for the current request
385 385
             $request = Craft::$app->getRequest();
386 386
             $requestPath = '/';
@@ -405,21 +405,21 @@  discard block
 block discarded – undo
405 405
                 }
406 406
             }
407 407
             // Get our cache key
408
-            $cacheKey = $uri . $siteId . $paginationPage . $requestPath . $this->getAllowedUrlParams() . $token;
408
+            $cacheKey = $uri.$siteId.$paginationPage.$requestPath.$this->getAllowedUrlParams().$token;
409 409
             // For requests with a status code of >= 400, use one cache key
410 410
             if (!$request->isConsoleRequest) {
411 411
                 $response = Craft::$app->getResponse();
412 412
                 if ($response->statusCode >= 400) {
413
-                    $cacheKey = $siteId . self::INVALID_RESPONSE_CACHE_KEY . $response->statusCode;
413
+                    $cacheKey = $siteId.self::INVALID_RESPONSE_CACHE_KEY.$response->statusCode;
414 414
                 }
415 415
             }
416 416
             // Load the meta containers
417 417
             $dependency = new TagDependency([
418 418
                 'tags' => [
419 419
                     self::GLOBAL_METACONTAINER_CACHE_TAG,
420
-                    self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId,
421
-                    self::METACONTAINER_CACHE_TAG . $uri . $siteId,
422
-                    self::METACONTAINER_CACHE_TAG . $cacheKey,
420
+                    self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId,
421
+                    self::METACONTAINER_CACHE_TAG.$uri.$siteId,
422
+                    self::METACONTAINER_CACHE_TAG.$cacheKey,
423 423
                 ],
424 424
             ]);
425 425
             $this->containerDependency = $dependency;
@@ -436,10 +436,10 @@  discard block
 block discarded – undo
436 436
             } else {
437 437
                 $cache = Craft::$app->getCache();
438 438
                 list($this->metaGlobalVars, $this->metaSiteVars, $this->metaSitemapVars, $this->metaContainers) = $cache->getOrSet(
439
-                    self::CACHE_KEY . $cacheKey,
439
+                    self::CACHE_KEY.$cacheKey,
440 440
                     function() use ($uri, $siteId) {
441 441
                         Craft::info(
442
-                            'Meta container cache miss: ' . $uri . '/' . $siteId,
442
+                            'Meta container cache miss: '.$uri.'/'.$siteId,
443 443
                             __METHOD__
444 444
                         );
445 445
                         $this->loadGlobalMetaContainers($siteId);
@@ -843,10 +843,10 @@  discard block
 block discarded – undo
843 843
         $cache = Craft::$app->getCache();
844 844
         TagDependency::invalidate(
845 845
             $cache,
846
-            self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId
846
+            self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId
847 847
         );
848 848
         Craft::info(
849
-            'Meta bundle cache cleared: ' . $metaBundleSourceId . ' / ' . $metaBundleSourceType . ' / ' . $siteId,
849
+            'Meta bundle cache cleared: '.$metaBundleSourceId.' / '.$metaBundleSourceType.' / '.$siteId,
850 850
             __METHOD__
851 851
         );
852 852
         // Trigger an event to let other plugins/modules know we've cleared our caches
@@ -873,9 +873,9 @@  discard block
 block discarded – undo
873 873
         if ($siteId === null) {
874 874
             $siteId = Craft::$app->getSites()->currentSite->id ?? 1;
875 875
         }
876
-        TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG . $uri . $siteId);
876
+        TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG.$uri.$siteId);
877 877
         Craft::info(
878
-            'Meta container cache cleared: ' . $uri . ' / ' . $siteId,
878
+            'Meta container cache cleared: '.$uri.' / '.$siteId,
879 879
             __METHOD__
880 880
         );
881 881
         // Trigger an event to let other plugins/modules know we've cleared our caches
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
                     // Handle re-creating the `mainEntityOfPage` so that the model injected into the
1020 1020
                     // templates has the appropriate attributes
1021
-                    $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE . JsonLdService::GENERAL_HANDLE;
1021
+                    $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE.JsonLdService::GENERAL_HANDLE;
1022 1022
                     $generalContainer = $this->metaContainers[$generalContainerKey];
1023 1023
                     if (($generalContainer !== null) && !empty($generalContainer->data['mainEntityOfPage'])) {
1024 1024
                         /** @var MetaJsonLd $jsonLdModel */
Please login to merge, or discard this patch.
src/helpers/Container.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,24 +90,24 @@
 block discarded – undo
90 90
         }
91 91
         // Get our cache key
92 92
         $asArrayKey = $asArray ? 'true' : 'false';
93
-        $cacheKey = $uri . $siteId . implode($containerKeys) . $asArrayKey . Seomatic::$environment . $token;
93
+        $cacheKey = $uri.$siteId.implode($containerKeys).$asArrayKey.Seomatic::$environment.$token;
94 94
         // Load the meta containers
95 95
         $dependency = new TagDependency([
96 96
             'tags' => [
97 97
                 $metaContainers::GLOBAL_METACONTAINER_CACHE_TAG,
98
-                $metaContainers::METACONTAINER_CACHE_TAG . $sourceId . $sourceBundleType . $siteId,
99
-                $metaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId,
100
-                $metaContainers::METACONTAINER_CACHE_TAG . $cacheKey,
98
+                $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType.$siteId,
99
+                $metaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId,
100
+                $metaContainers::METACONTAINER_CACHE_TAG.$cacheKey,
101 101
             ],
102 102
         ]);
103 103
 
104 104
         $cache = Craft::$app->getCache();
105 105
         $result = $cache->getOrSet(
106
-            self::CACHE_KEY . $cacheKey,
106
+            self::CACHE_KEY.$cacheKey,
107 107
             function() use ($uri, $siteId, $containerKeys, $asArray) {
108 108
                 $result = [];
109 109
                 Craft::info(
110
-                    'Meta controller container cache miss: ' . $uri . '/' . $siteId,
110
+                    'Meta controller container cache miss: '.$uri.'/'.$siteId,
111 111
                     __METHOD__
112 112
                 );
113 113
                 // Load the meta containers and parse our globals
Please login to merge, or discard this patch.
src/Seomatic.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $lastSegment = end($segments);
348 348
             $site = Craft::$app->getSites()->getSiteByHandle($lastSegment);
349 349
             if ($site !== null) {
350
-                $siteSuffix = '/' . $lastSegment;
350
+                $siteSuffix = '/'.$lastSegment;
351 351
             }
352 352
         }
353 353
         $currentUser = Craft::$app->getUser()->getIdentity();
@@ -355,31 +355,31 @@  discard block
 block discarded – undo
355 355
         if ($currentUser->can('seomatic:dashboard')) {
356 356
             $subNavs['dashboard'] = [
357 357
                 'label' => Craft::t('seomatic', 'Dashboard'),
358
-                'url' => 'seomatic/dashboard' . $siteSuffix,
358
+                'url' => 'seomatic/dashboard'.$siteSuffix,
359 359
             ];
360 360
         }
361 361
         if ($currentUser->can('seomatic:global-meta')) {
362 362
             $subNavs['global'] = [
363 363
                 'label' => Craft::t('seomatic', 'Global SEO'),
364
-                'url' => 'seomatic/global/general' . $siteSuffix,
364
+                'url' => 'seomatic/global/general'.$siteSuffix,
365 365
             ];
366 366
         }
367 367
         if ($currentUser->can('seomatic:content-meta')) {
368 368
             $subNavs['content'] = [
369 369
                 'label' => Craft::t('seomatic', 'Content SEO'),
370
-                'url' => 'seomatic/content' . $siteSuffix,
370
+                'url' => 'seomatic/content'.$siteSuffix,
371 371
             ];
372 372
         }
373 373
         if ($currentUser->can('seomatic:site-settings')) {
374 374
             $subNavs['site'] = [
375 375
                 'label' => Craft::t('seomatic', 'Site Settings'),
376
-                'url' => 'seomatic/site/identity' . $siteSuffix,
376
+                'url' => 'seomatic/site/identity'.$siteSuffix,
377 377
             ];
378 378
         }
379 379
         if ($currentUser->can('seomatic:tracking-scripts')) {
380 380
             $subNavs['tracking'] = [
381 381
                 'label' => Craft::t('seomatic', 'Tracking Scripts'),
382
-                'url' => 'seomatic/tracking/gtag' . $siteSuffix,
382
+                'url' => 'seomatic/tracking/gtag'.$siteSuffix,
383 383
             ];
384 384
         }
385 385
         $editableSettings = true;
@@ -573,14 +573,14 @@  discard block
 block discarded – undo
573 573
                     $element = $e->sender;
574 574
                     if ($element->uri !== null) {
575 575
                         $e->previewTargets[] = [
576
-                            'label' => '
Please login to merge, or discard this patch.