Passed
Push — v3 ( f0e099...2662c8 )
by Andrew
28:59 queued 08:38
created
src/helpers/Sitemap.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         if ($multiSite) {
139 139
             $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"';
140 140
         }
141
-        if ((bool)$metaBundle->metaSitemapVars->newsSitemap) {
141
+        if ((bool) $metaBundle->metaSitemapVars->newsSitemap) {
142 142
             $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"';
143 143
         }
144 144
         $urlsetLine .= '>';
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
                         $paginator->getTotalPages(),
215 215
                         $paginator->getTotalResults());
216 216
                 }
217
-                echo $message . PHP_EOL;
217
+                echo $message.PHP_EOL;
218 218
             }
219 219
             /** @var Element $element */
220 220
             foreach ($elements as $element) {
221 221
                 // Output some info if this is a console app
222 222
                 if (Craft::$app instanceof ConsoleApplication) {
223
-                    echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL;
223
+                    echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL;
224 224
                 }
225 225
 
226 226
                 $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                         }
269 269
                         $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl);
270 270
                         if ($url !== $canonicalUrl) {
271
-                            Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri);
271
+                            Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri);
272 272
                             continue;
273 273
                         }
274 274
                     }
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
                                             if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) {
330 330
                                                 $lines[] = '<xhtml:link rel="alternate"'
331 331
                                                     . ' hreflang="x-default"'
332
-                                                    . ' href="' . self::encodeSitemapEntity($altUrl) . '"'
332
+                                                    . ' href="'.self::encodeSitemapEntity($altUrl).'"'
333 333
                                                     . ' />';
334 334
                                             }
335 335
                                             $lines[] = '<xhtml:link rel="alternate"'
336
-                                                . ' hreflang="' . $altSiteSettings['language'] . '"'
337
-                                                . ' href="' . self::encodeSitemapEntity($altUrl) . '"'
336
+                                                . ' hreflang="'.$altSiteSettings['language'].'"'
337
+                                                . ' href="'.self::encodeSitemapEntity($altUrl).'"'
338 338
                                                 . ' />';
339 339
                                         }
340 340
                                     }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                         }
344 344
                     }
345 345
                     // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap
346
-                    if ((bool)$metaBundle->metaSitemapVars->newsSitemap) {
346
+                    if ((bool) $metaBundle->metaSitemapVars->newsSitemap) {
347 347
                         $now = new DateTime();
348 348
                         $interval = $now->diff($dateUpdated);
349 349
                         if ($interval->days <= 2) {
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
                             }
354 354
                             $lines[] = '<news:news>';
355 355
                             $lines[] = '<news:publication>';
356
-                            $lines[] = '<news:name>' . self::encodeSitemapEntity($metaBundle->metaSitemapVars->newsPublicationName) . '</news:name>';
357
-                            $lines[] = '<news:language>' . $language . '</news:language>';
356
+                            $lines[] = '<news:name>'.self::encodeSitemapEntity($metaBundle->metaSitemapVars->newsPublicationName).'</news:name>';
357
+                            $lines[] = '<news:language>'.$language.'</news:language>';
358 358
                             $lines[] = '</news:publication>';
359
-                            $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>';
360
-                            $lines[] = '<news:title>' . self::encodeSitemapEntity($element->title) . '</news:title>';
359
+                            $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>';
360
+                            $lines[] = '<news:title>'.self::encodeSitemapEntity($element->title).'</news:title>';
361 361
                             $lines[] = '</news:news>';
362 362
                         }
363 363
                     }
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
      */
631 631
     protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines)
632 632
     {
633
-        if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) {
633
+        if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) {
634 634
             switch ($asset->kind) {
635 635
                 case 'image':
636 636
                     $transform = Craft::$app->getAssetTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform ?? '');
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
                         $fieldName = $row['field'] ?? '';
644 644
                         $propName = $row['property'] ?? '';
645 645
                         if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) {
646
-                            $lines[] = '<image:' . $propName . '>';
646
+                            $lines[] = '<image:'.$propName.'>';
647 647
                             $lines[] = self::encodeSitemapEntity($asset[$fieldName]);
648
-                            $lines[] = '</image:' . $propName . '>';
648
+                            $lines[] = '</image:'.$propName.'>';
649 649
                         }
650 650
                     }
651 651
                     $lines[] = '</image:image>';
@@ -661,9 +661,9 @@  discard block
 block discarded – undo
661 661
                         $fieldName = $row['field'] ?? '';
662 662
                         $propName = $row['property'] ?? '';
663 663
                         if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) {
664
-                            $lines[] = '<video:' . $propName . '>';
664
+                            $lines[] = '<video:'.$propName.'>';
665 665
                             $lines[] = self::encodeSitemapEntity($asset[$fieldName]);
666
-                            $lines[] = '</video:' . $propName . '>';
666
+                            $lines[] = '</video:'.$propName.'>';
667 667
                         }
668 668
                     }
669 669
                     $lines[] = '</video:video>';
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
      */
680 680
     protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines)
681 681
     {
682
-        if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) {
682
+        if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) {
683 683
             if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) {
684 684
                 $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime();
685 685
                 $lines[] = '<url>';
Please login to merge, or discard this patch.
src/services/MetaContainers.php 1 patch
Spacing   +17 added lines, -17 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,22 +405,22 @@  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,
423
-                    self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType,
420
+                    self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId,
421
+                    self::METACONTAINER_CACHE_TAG.$uri.$siteId,
422
+                    self::METACONTAINER_CACHE_TAG.$cacheKey,
423
+                    self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType,
424 424
                 ],
425 425
             ]);
426 426
             $this->containerDependency = $dependency;
@@ -437,10 +437,10 @@  discard block
 block discarded – undo
437 437
             } else {
438 438
                 $cache = Craft::$app->getCache();
439 439
                 list($this->metaGlobalVars, $this->metaSiteVars, $this->metaSitemapVars, $this->metaContainers) = $cache->getOrSet(
440
-                    self::CACHE_KEY . $cacheKey,
440
+                    self::CACHE_KEY.$cacheKey,
441 441
                     function() use ($uri, $siteId) {
442 442
                         Craft::info(
443
-                            'Meta container cache miss: ' . $uri . '/' . $siteId,
443
+                            'Meta container cache miss: '.$uri.'/'.$siteId,
444 444
                             __METHOD__
445 445
                         );
446 446
                         $this->loadGlobalMetaContainers($siteId);
@@ -841,10 +841,10 @@  discard block
 block discarded – undo
841 841
         $cache = Craft::$app->getCache();
842 842
         TagDependency::invalidate(
843 843
             $cache,
844
-            self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId
844
+            self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId
845 845
         );
846 846
         Craft::info(
847
-            'Meta bundle cache cleared: ' . $metaBundleSourceId . ' / ' . $metaBundleSourceType . ' / ' . $siteId,
847
+            'Meta bundle cache cleared: '.$metaBundleSourceId.' / '.$metaBundleSourceType.' / '.$siteId,
848 848
             __METHOD__
849 849
         );
850 850
         // Trigger an event to let other plugins/modules know we've cleared our caches
@@ -871,9 +871,9 @@  discard block
 block discarded – undo
871 871
         if ($siteId === null) {
872 872
             $siteId = Craft::$app->getSites()->currentSite->id ?? 1;
873 873
         }
874
-        TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG . $uri . $siteId);
874
+        TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG.$uri.$siteId);
875 875
         Craft::info(
876
-            'Meta container cache cleared: ' . $uri . ' / ' . $siteId,
876
+            'Meta container cache cleared: '.$uri.' / '.$siteId,
877 877
             __METHOD__
878 878
         );
879 879
         // Trigger an event to let other plugins/modules know we've cleared our caches
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
                     // Handle re-creating the `mainEntityOfPage` so that the model injected into the
1018 1018
                     // templates has the appropriate attributes
1019
-                    $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE . JsonLdService::GENERAL_HANDLE;
1019
+                    $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE.JsonLdService::GENERAL_HANDLE;
1020 1020
                     $generalContainer = $this->metaContainers[$generalContainerKey];
1021 1021
                     if (($generalContainer !== null) && !empty($generalContainer->data['mainEntityOfPage'])) {
1022 1022
                         /** @var MetaJsonLd $jsonLdModel */
Please login to merge, or discard this patch.
src/helpers/Container.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,25 +90,25 @@
 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,
101
-                $metaContainers::METACONTAINER_CACHE_TAG . $sourceId . $sourceBundleType,
98
+                $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType.$siteId,
99
+                $metaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId,
100
+                $metaContainers::METACONTAINER_CACHE_TAG.$cacheKey,
101
+                $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType,
102 102
             ],
103 103
         ]);
104 104
 
105 105
         $cache = Craft::$app->getCache();
106 106
         $result = $cache->getOrSet(
107
-            self::CACHE_KEY . $cacheKey,
107
+            self::CACHE_KEY.$cacheKey,
108 108
             function() use ($uri, $siteId, $containerKeys, $asArray) {
109 109
                 $result = [];
110 110
                 Craft::info(
111
-                    'Meta controller container cache miss: ' . $uri . '/' . $siteId,
111
+                    'Meta controller container cache miss: '.$uri.'/'.$siteId,
112 112
                     __METHOD__
113 113
                 );
114 114
                 // Load the meta containers and parse our globals
Please login to merge, or discard this patch.
src/fields/SeoSettings.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         if ($element !== null && $element->uri !== null) {
377 377
             $siteId = $element->siteId;
378 378
             $uri = $element->uri;
379
-            $cacheKey = self::CACHE_KEY . $uri . $siteId . $this->elementDisplayPreviewType;
379
+            $cacheKey = self::CACHE_KEY.$uri.$siteId.$this->elementDisplayPreviewType;
380 380
             $metaBundleSourceType = Seomatic::$plugin->seoElements->getMetaBundleTypeFromElement($element);
381 381
             $seoElement = Seomatic::$plugin->seoElements->getSeoElementByMetaBundleType($metaBundleSourceType);
382 382
             $metaBundleSourceType = SeoEntry::getMetaBundleType();
@@ -387,15 +387,15 @@  discard block
 block discarded – undo
387 387
             $dependency = new TagDependency([
388 388
                 'tags' => [
389 389
                     MetaContainers::GLOBAL_METACONTAINER_CACHE_TAG,
390
-                    MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId,
391
-                    MetaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId,
392
-                    MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType,
390
+                    MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId,
391
+                    MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId,
392
+                    MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType,
393 393
                 ],
394 394
             ]);
395 395
             $cache = Craft::$app->getCache();
396 396
             $cacheDuration = null;
397 397
             $html = $cache->getOrSet(
398
-                self::CACHE_KEY . $cacheKey,
398
+                self::CACHE_KEY.$cacheKey,
399 399
                 function() use ($uri, $siteId, $element) {
400 400
                     Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true, true, $element);
401 401
                     $variables = [
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
         array   &$variables
438 438
     ) {
439 439
         $variables['textFieldSources'] = array_merge(
440
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'],
440
+            ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'],
441 441
             FieldHelper::fieldsOfTypeFromElement(
442 442
                 $element,
443 443
                 FieldHelper::TEXT_FIELD_CLASS_KEY,
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
             )
446 446
         );
447 447
         $variables['assetFieldSources'] = array_merge(
448
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields']],
448
+            ['entryGroup' => ['optgroup' => $groupName.' Fields']],
449 449
             FieldHelper::fieldsOfTypeFromElement(
450 450
                 $element,
451 451
                 FieldHelper::ASSET_FIELD_CLASS_KEY,
Please login to merge, or discard this patch.
src/services/MetaBundles.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      * @param MetaBundle $metaBundle
195 195
      * @param bool $forceUpdate
196 196
      */
197
-    public function syncBundleWithConfig(MetaBundle &$metaBundle, bool $forceUpdate = false)
197
+    public function syncBundleWithConfig(MetaBundle & $metaBundle, bool $forceUpdate = false)
198 198
     {
199 199
         $prevMetaBundle = $metaBundle;
200 200
         $config = [];
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
      */
276 276
     public function updateMetaBundle(MetaBundle $metaBundle, int $siteId)
277 277
     {
278
-        $metaBundle->sourceName = (string)$metaBundle->sourceName;
279
-        $metaBundle->sourceTemplate = (string)$metaBundle->sourceTemplate;
278
+        $metaBundle->sourceName = (string) $metaBundle->sourceName;
279
+        $metaBundle->sourceTemplate = (string) $metaBundle->sourceTemplate;
280 280
         // Make sure it validates
281 281
         if ($metaBundle->validate(null, true)) {
282 282
             // Save it out to a record
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                 'sourceSiteId' => $siteId,
287 287
             ];
288 288
             if ($metaBundle->typeId !== null) {
289
-                $metaBundle->typeId = (int)$metaBundle->typeId;
289
+                $metaBundle->typeId = (int) $metaBundle->typeId;
290 290
             }
291 291
             if (!empty($metaBundle->typeId)) {
292 292
                 $params['typeId'] = $metaBundle->typeId;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             // The issue was that the containers were getting saved to the db with a hard-coded setting in them, because they'd
304 304
             // been set that way by the environment, whereas to be changeable via the GUI, it needs to be set to {seomatic.meta.robots}
305 305
             /** @var RobotsTag|null $robotsTag */
306
-            $robotsTag = $metaBundle->metaContainers[MetaTagContainer::CONTAINER_TYPE . TagService::GENERAL_HANDLE]->data['robots'] ?? null;
306
+            $robotsTag = $metaBundle->metaContainers[MetaTagContainer::CONTAINER_TYPE.TagService::GENERAL_HANDLE]->data['robots'] ?? null;
307 307
             if (!empty($robotsTag)) {
308 308
                 $robotsTag->content = $robotsTag->environment['live']['content'] ?? '{seomatic.meta.robots}';
309 309
             }
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                     $metaBundleDefaults = ArrayHelper::merge(
385 385
                         $seoElement::metaBundleConfig($sourceModel),
386 386
                         [
387
-                            'sourceTemplate' => (string)$siteSetting->template,
387
+                            'sourceTemplate' => (string) $siteSetting->template,
388 388
                             'sourceSiteId' => $siteSetting->siteId,
389 389
                             'sourceAltSiteSettings' => $siteSettingsArray,
390 390
                             'sourceDateUpdated' => $dateUpdated,
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
     public function getMetaBundleBySourceHandle(string $sourceBundleType, string $sourceHandle, int $sourceSiteId, $typeId = null)
434 434
     {
435 435
         $metaBundle = null;
436
-        $typeId = (int)$typeId;
436
+        $typeId = (int) $typeId;
437 437
         // See if we have the meta bundle cached
438 438
         if (!empty($this->metaBundlesBySourceHandle[$sourceBundleType][$sourceHandle][$sourceSiteId][$typeId])) {
439 439
             $id = $this->metaBundlesBySourceHandle[$sourceBundleType][$sourceHandle][$sourceSiteId][$typeId];
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
                             /** @var Section|CategoryGroup|ProductType $sourceModel */
521 521
                             $sourceModel = $seoElement::sourceModelFromId($sourceId);
522 522
                             if ($sourceModel !== null) {
523
-                                $metaBundle->sourceName = (string)$sourceModel->name;
523
+                                $metaBundle->sourceName = (string) $sourceModel->name;
524 524
                                 $metaBundle->sourceHandle = $sourceModel->handle;
525 525
                             }
526 526
                         }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     public function getMetaBundleBySourceId(string $sourceBundleType, int $sourceId, ?int $sourceSiteId, $typeId = null)
560 560
     {
561 561
         $metaBundle = null;
562
-        $typeId = (int)$typeId;
562
+        $typeId = (int) $typeId;
563 563
         // See if we have the meta bundle cached
564 564
         if (!empty($this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId])) {
565 565
             $id = $this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId];
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
                 ->where(['=', 'sourceBundleType', $seoElement::META_BUNDLE_TYPE])
754 754
                 ->andWhere(['typeId' => null]);
755 755
 
756
-            if ((int)$sourceSiteId !== 0) {
756
+            if ((int) $sourceSiteId !== 0) {
757 757
                 $subQuery->andWhere(['sourceSiteId' => $sourceSiteId]);
758 758
             }
759 759
             if ($filter !== '') {
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
     public function getContentMetaBundleForElement(Element $element)
791 791
     {
792 792
         $source = $this->getMetaSourceFromElement($element);
793
-        $key = implode(".", $source) . '.' . $element->siteId;
793
+        $key = implode(".", $source).'.'.$element->siteId;
794 794
 
795 795
         if (empty($this->elementContentMetaBundles[$key])) {
796 796
             $this->elementContentMetaBundles[$key] = $this->getMetaBundleBySourceId($source[1], $source[0], $element->siteId, $source[4]);
Please login to merge, or discard this patch.
src/Seomatic.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         self::$cacheDuration = self::$devMode
287 287
             ? self::DEVMODE_CACHE_DURATION
288 288
             : self::$settings->metaCacheDuration ?? null;
289
-        self::$cacheDuration = self::$cacheDuration === null ? null : (int)self::$cacheDuration;
289
+        self::$cacheDuration = self::$cacheDuration === null ? null : (int) self::$cacheDuration;
290 290
         self::$environment = EnvironmentHelper::determineEnvironment();
291 291
         MetaValueHelper::cache();
292 292
         // Version helpers
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             $lastSegment = end($segments);
409 409
             $site = Craft::$app->getSites()->getSiteByHandle($lastSegment);
410 410
             if ($site !== null) {
411
-                $siteSuffix = '/' . $lastSegment;
411
+                $siteSuffix = '/'.$lastSegment;
412 412
             }
413 413
         }
414 414
         /** @var User $currentUser */
@@ -417,31 +417,31 @@  discard block
 block discarded – undo
417 417
         if ($currentUser->can('seomatic:dashboard')) {
418 418
             $subNavs['dashboard'] = [
419 419
                 'label' => Craft::t('seomatic', 'Dashboard'),
420
-                'url' => 'seomatic/dashboard' . $siteSuffix,
420
+                'url' => 'seomatic/dashboard'.$siteSuffix,
421 421
             ];
422 422
         }
423 423
         if ($currentUser->can('seomatic:global-meta')) {
424 424
             $subNavs['global'] = [
425 425
                 'label' => Craft::t('seomatic', 'Global SEO'),
426
-                'url' => 'seomatic/global/general' . $siteSuffix,
426
+                'url' => 'seomatic/global/general'.$siteSuffix,
427 427
             ];
428 428
         }
429 429
         if ($currentUser->can('seomatic:content-meta')) {
430 430
             $subNavs['content'] = [
431 431
                 'label' => Craft::t('seomatic', 'Content SEO'),
432
-                'url' => 'seomatic/content' . $siteSuffix,
432
+                'url' => 'seomatic/content'.$siteSuffix,
433 433
             ];
434 434
         }
435 435
         if ($currentUser->can('seomatic:site-settings')) {
436 436
             $subNavs['site'] = [
437 437
                 'label' => Craft::t('seomatic', 'Site Settings'),
438
-                'url' => 'seomatic/site/identity' . $siteSuffix,
438
+                'url' => 'seomatic/site/identity'.$siteSuffix,
439 439
             ];
440 440
         }
441 441
         if ($currentUser->can('seomatic:tracking-scripts')) {
442 442
             $subNavs['tracking'] = [
443 443
                 'label' => Craft::t('seomatic', 'Tracking Scripts'),
444
-                'url' => 'seomatic/tracking/gtag' . $siteSuffix,
444
+                'url' => 'seomatic/tracking/gtag'.$siteSuffix,
445 445
             ];
446 446
         }
447 447
         $editableSettings = true;
@@ -638,14 +638,14 @@  discard block
 block discarded – undo
638 638
                     $element = $e->sender;
639 639
                     if ($element->uri !== null) {
640 640
                         $e->previewTargets[] = [
641
-                            'label' => '
Please login to merge, or discard this patch.
src/models/SitemapCustomTemplate.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -127,18 +127,18 @@  discard block
 block discarded – undo
127 127
         $dependency = new TagDependency([
128 128
             'tags' => [
129 129
                 self::GLOBAL_SITEMAP_CACHE_TAG,
130
-                self::SITEMAP_CACHE_TAG . $handle . $siteId,
130
+                self::SITEMAP_CACHE_TAG.$handle.$siteId,
131 131
             ],
132 132
         ]);
133 133
 
134 134
         $cacheDuration = Seomatic::$plugin->helper::isPreview() ? 1 : Seomatic::$cacheDuration;
135 135
 
136
-        return $cache->getOrSet(self::CACHE_KEY . $groupId . self::CUSTOM_SCOPE . $handle . $siteId, function() use (
136
+        return $cache->getOrSet(self::CACHE_KEY.$groupId.self::CUSTOM_SCOPE.$handle.$siteId, function() use (
137 137
             $handle,
138 138
             $siteId
139 139
         ) {
140 140
             Craft::info(
141
-                'Sitemap Custom cache miss: ' . $handle . '/' . $siteId,
141
+                'Sitemap Custom cache miss: '.$handle.'/'.$siteId,
142 142
                 __METHOD__
143 143
             );
144 144
             $lines = [];
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $handle = self::CUSTOM_HANDLE;
213 213
         $cache = Craft::$app->getCache();
214
-        TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId);
214
+        TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId);
215 215
         Craft::info(
216
-            'Sitemap Custom cache cleared: ' . $handle,
216
+            'Sitemap Custom cache cleared: '.$handle,
217 217
             __METHOD__
218 218
         );
219 219
     }
Please login to merge, or discard this patch.
src/models/SitemapIndexTemplate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getFilename(int $groupId): string
119 119
     {
120
-        return 'sitemaps-' . $groupId . '-sitemap.xml';
120
+        return 'sitemaps-'.$groupId.'-sitemap.xml';
121 121
     }
122 122
 
123 123
     /**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         $cacheDuration = Seomatic::$plugin->helper::isPreview() ? 1 : Seomatic::$cacheDuration;
153 153
 
154
-        return $cache->getOrSet(self::CACHE_KEY . $groupId . '.' . $siteId, function() use ($groupSiteIds, $siteId) {
154
+        return $cache->getOrSet(self::CACHE_KEY.$groupId.'.'.$siteId, function() use ($groupSiteIds, $siteId) {
155 155
             Craft::info(
156 156
                 'Sitemap index cache miss',
157 157
                 __METHOD__
Please login to merge, or discard this patch.
src/helpers/Schema.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             // Go from most specific type to least specific type
100 100
             foreach (self::SCHEMA_TYPES as $schemaType) {
101 101
                 if (!empty($settings[$schemaType]) && ($settings[$schemaType] !== 'none')) {
102
-                    $result = $settings[$schemaType] . self::SCHEMA_PATH_DELIMITER . $result;
102
+                    $result = $settings[$schemaType].self::SCHEMA_PATH_DELIMITER.$result;
103 103
                 }
104 104
             }
105 105
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             $description = $result['schemaTypeDescription'];
126 126
             $description = preg_replace("`\[\[([A-z]*)\]\]`", '[$1](https://schema.org/$1)', $description);
127 127
             $description = preg_replace('/\s+/', ' ', $description);
128
-            $description = Markdown::process((string)$description);
128
+            $description = Markdown::process((string) $description);
129 129
             $description = str_replace(['<p>', '</p>', '\n'], ['', '', ' '], $description);
130 130
             $result['schemaTypeDescription'] = $description;
131 131
         }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     {
145 145
         $result = [];
146 146
         while ($schemaType) {
147
-            $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $schemaType;
147
+            $className = 'nystudio107\\seomatic\\models\\jsonld\\'.$schemaType;
148 148
             if (class_exists($className)) {
149 149
                 $classRef = new ReflectionClass($className);
150 150
                 $staticProps = $classRef->getStaticProperties();
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
         $dependency = new TagDependency([
244 244
             'tags' => [
245 245
                 self::GLOBAL_SCHEMA_CACHE_TAG,
246
-                self::SCHEMA_CACHE_TAG . 'schemaArray',
246
+                self::SCHEMA_CACHE_TAG.'schemaArray',
247 247
             ],
248 248
         ]);
249 249
         $cache = Craft::$app->getCache();
250 250
         $typesArray = $cache->getOrSet(
251
-            self::CACHE_KEY . 'schemaArray',
251
+            self::CACHE_KEY.'schemaArray',
252 252
             function() use ($path) {
253 253
                 Craft::info(
254
-                    'schemaArray cache miss: ' . $path,
254
+                    'schemaArray cache miss: '.$path,
255 255
                     __METHOD__
256 256
                 );
257 257
                 $filePath = Craft::getAlias('@nystudio107/seomatic/resources/schema/tree.jsonld');
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
         $dependency = new TagDependency([
317 317
             'tags' => [
318 318
                 self::GLOBAL_SCHEMA_CACHE_TAG,
319
-                self::SCHEMA_CACHE_TAG . 'schemaTree',
319
+                self::SCHEMA_CACHE_TAG.'schemaTree',
320 320
             ],
321 321
         ]);
322 322
         $cache = Craft::$app->getCache();
323 323
         $typesArray = $cache->getOrSet(
324
-            self::CACHE_KEY . 'schemaTree',
324
+            self::CACHE_KEY.'schemaTree',
325 325
             function() {
326 326
                 Craft::info(
327 327
                     'schemaTree cache miss',
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
         foreach ($typesArray as $key => $value) {
386 386
             $indent = html_entity_decode(str_repeat('&nbsp;', $indentLevel));
387 387
             if (is_array($value)) {
388
-                $result[$key] = $indent . $key;
388
+                $result[$key] = $indent.$key;
389 389
                 $value = self::flattenSchemaArray($value, $indentLevel + self::MENU_INDENT_STEP);
390 390
                 $result = array_merge($result, $value);
391 391
             } else {
392
-                $result[$key] = $indent . $value;
392
+                $result[$key] = $indent.$value;
393 393
             }
394 394
         }
395 395
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
             $children = [];
484 484
             $name = $typesArray['name'];
485 485
             // Construct a path-based $id, excluding the top-level `Thing` schema
486
-            $id = $name === 'Thing' ? '' : $path . self::SCHEMA_PATH_DELIMITER . $name;
486
+            $id = $name === 'Thing' ? '' : $path.self::SCHEMA_PATH_DELIMITER.$name;
487 487
             $id = ltrim($id, self::SCHEMA_PATH_DELIMITER);
488 488
             // Make sure we have at most 3 specifiers in the schema path
489 489
             $parts = explode(self::SCHEMA_PATH_DELIMITER, $id);
@@ -510,12 +510,12 @@  discard block
 block discarded – undo
510 510
             $schemaPath = explode(self::SCHEMA_PATH_DELIMITER, $id);
511 511
             // Use only the specific (last) type for now, rather than the complete path of types
512 512
             $schemaPath = [end($schemaPath)];
513
-            if ((bool)array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) {
514
-                $name .= ' (' . Craft::t('seomatic', 'Google rich result') . ')';
513
+            if ((bool) array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) {
514
+                $name .= ' ('.Craft::t('seomatic', 'Google rich result').')';
515 515
             }
516 516
             // Mark it as pending, if applicable
517 517
             if (isset($typesArray['pending']) && $typesArray['pending']) {
518
-                $name .= ' (' . Craft::t('seomatic', 'pending') . ')';
518
+                $name .= ' ('.Craft::t('seomatic', 'pending').')';
519 519
             }
520 520
             $result['label'] = $name;
521 521
             $result['id'] = $id;
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
         $dependency = new TagDependency([
535 535
             'tags' => [
536 536
                 self::GLOBAL_SCHEMA_CACHE_TAG,
537
-                self::SCHEMA_CACHE_TAG . 'googleRichSnippets',
537
+                self::SCHEMA_CACHE_TAG.'googleRichSnippets',
538 538
             ],
539 539
         ]);
540 540
         $cache = Craft::$app->getCache();
541 541
         return $cache->getOrSet(
542
-            self::CACHE_KEY . 'googleRichSnippets',
542
+            self::CACHE_KEY.'googleRichSnippets',
543 543
             function() {
544 544
                 Craft::info(
545 545
                     'googleRichSnippets cache miss',
Please login to merge, or discard this patch.