Passed
Push — develop ( 4ecca4...0e6700 )
by Andrew
18:12 queued 09:07
created
src/helpers/Sitemap.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         // Output some info if this is a console app
81 81
         if ($job && Craft::$app instanceof ConsoleApplication) {
82
-            echo $job->description . PHP_EOL;
82
+            echo $job->description.PHP_EOL;
83 83
         }
84 84
 
85 85
         $lines = [];
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
             while ($currentElement < $totalElements) {
140 140
                 $elements = $paginator->getPageResults();
141 141
                 if (Craft::$app instanceof ConsoleApplication) {
142
-                    echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages()
143
-                        . ' - elements: ' . $paginator->getTotalResults()
142
+                    echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages()
143
+                        . ' - elements: '.$paginator->getTotalResults()
144 144
                         . PHP_EOL;
145 145
                 }
146 146
                 /** @var ElementInterface $element */
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                     }
153 153
                     // Output some info if this is a console app
154 154
                     if (Craft::$app instanceof ConsoleApplication) {
155
-                        echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL;
155
+                        echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL;
156 156
                     }
157 157
 
158 158
                     $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                             }
190 190
                             $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl);
191 191
                             if ($url !== $canonicalUrl) {
192
-                                Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri);
192
+                                Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri);
193 193
                                 continue;
194 194
                             }
195 195
                         }
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
                                                 if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) {
247 247
                                                     $lines[] = '<xhtml:link rel="alternate"'
248 248
                                                         . ' hreflang="x-default"'
249
-                                                        . ' href="' . Html::encode($altUrl) . '"'
249
+                                                        . ' href="'.Html::encode($altUrl).'"'
250 250
                                                         . ' />';
251 251
                                                 }
252 252
                                                 $lines[] = '<xhtml:link rel="alternate"'
253
-                                                    . ' hreflang="' . $altSiteSettings['language'] . '"'
254
-                                                    . ' href="' . Html::encode($altUrl) . '"'
253
+                                                    . ' hreflang="'.$altSiteSettings['language'].'"'
254
+                                                    . ' href="'.Html::encode($altUrl).'"'
255 255
                                                     . ' />';
256 256
                                             }
257 257
                                         }
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
         }
352 352
 
353 353
         $cache = Craft::$app->getCache();
354
-        $cacheKey = SitemapTemplate::CACHE_KEY . $groupId . $type . $handle . $siteId;
354
+        $cacheKey = SitemapTemplate::CACHE_KEY.$groupId.$type.$handle.$siteId;
355 355
         $dependency = new TagDependency([
356 356
             'tags' => [
357 357
                 SitemapTemplate::GLOBAL_SITEMAP_CACHE_TAG,
358
-                SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId,
358
+                SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId,
359 359
             ],
360 360
         ]);
361 361
         $lines = implode('', $lines);
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
         $result = $cache->set($cacheKey, $lines, $cacheDuration, $dependency);
369 369
         // Remove the queue job id from the cache too
370 370
         $cache->delete($queueJobCacheKey);
371
-        Craft::debug('Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey, __METHOD__);
371
+        Craft::debug('Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey, __METHOD__);
372 372
         // Output some info if this is a console app
373 373
         if (Craft::$app instanceof ConsoleApplication) {
374
-            echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL;
374
+            echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL;
375 375
         }
376 376
         // If the FastCGI Cache Bust plugin is installed, clear its caches too
377 377
         $plugin = Craft::$app->getPlugins()->getPlugin('fastcgi-cache-bust');
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
      */
485 485
     protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines)
486 486
     {
487
-        if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) {
487
+        if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) {
488 488
             switch ($asset->kind) {
489 489
                 case 'image':
490 490
                     $lines[] = '<image:image>';
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
                         $fieldName = $row['field'] ?? '';
497 497
                         $propName = $row['property'] ?? '';
498 498
                         if (!empty($asset[$fieldName]) && !empty($propName)) {
499
-                            $lines[] = '<image:' . $propName . '>';
499
+                            $lines[] = '<image:'.$propName.'>';
500 500
                             $lines[] = Html::encode($asset[$fieldName]);
501
-                            $lines[] = '</image:' . $propName . '>';
501
+                            $lines[] = '</image:'.$propName.'>';
502 502
                         }
503 503
                     }
504 504
                     $lines[] = '</image:image>';
@@ -514,9 +514,9 @@  discard block
 block discarded – undo
514 514
                         $fieldName = $row['field'] ?? '';
515 515
                         $propName = $row['property'] ?? '';
516 516
                         if (!empty($asset[$fieldName]) && !empty($propName)) {
517
-                            $lines[] = '<video:' . $propName . '>';
517
+                            $lines[] = '<video:'.$propName.'>';
518 518
                             $lines[] = Html::encode($asset[$fieldName]);
519
-                            $lines[] = '</video:' . $propName . '>';
519
+                            $lines[] = '</video:'.$propName.'>';
520 520
                         }
521 521
                     }
522 522
                     $lines[] = '</video:video>';
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
      */
533 533
     protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines)
534 534
     {
535
-        if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) {
535
+        if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) {
536 536
             if (\in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) {
537 537
                 $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new \DateTime;
538 538
                 $lines[] = '<url>';
Please login to merge, or discard this patch.