Test Failed
Push — v4 ( b350db...8df9dc )
by Andrew
21:15 queued 10:54
created
src/controllers/SettingsController.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     /**
89 89
      * @inheritdoc
90 90
      */
91
-    protected array|bool|int $allowAnonymous = [
91
+    protected array | bool | int $allowAnonymous = [
92 92
     ];
93 93
 
94 94
     // Public Methods
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $variables['pluginName'] = Seomatic::$settings->pluginName;
133 133
         $variables['title'] = $templateTitle;
134 134
         $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
135
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
135
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
136 136
         $variables['crumbs'] = [
137 137
             [
138 138
                 'label' => $pluginName,
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             ],
141 141
             [
142 142
                 'label' => $templateTitle,
143
-                'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri),
143
+                'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri),
144 144
             ],
145 145
         ];
146 146
         $variables['selectedSubnavItem'] = 'dashboard';
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
         foreach ($variables['metaBundles'] as $metaBundle) {
164 164
             $stat = 0;
165 165
             foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) {
166
-                $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]);
166
+                $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]);
167 167
                 $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0;
168 168
                 $variables['contentSetupChecklist'][$setupField] = [
169 169
                     'label' => $setupLabel,
170
-                    'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]),
170
+                    'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]),
171 171
                 ];
172 172
             }
173 173
             $stat = round($numGrades - (($stat * $numGrades) / $numFields));
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
         }
179 179
         // Global SEO grades
180 180
         Seomatic::$previewingMetaContainers = true;
181
-        $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId);
181
+        $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId);
182 182
         Seomatic::$previewingMetaContainers = false;
183 183
         if ($metaBundle !== null) {
184 184
             $stat = 0;
185 185
             $variables['globalSetupChecklist'] = [];
186 186
             foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) {
187
-                $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]);
187
+                $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]);
188 188
                 $variables['globalSetupChecklist'][$setupField] = [
189 189
                     'label' => $setupLabel,
190
-                    'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]),
190
+                    'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]),
191 191
                 ];
192 192
             }
193 193
             $stat = round(($stat / $numFields) * 100);
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
             $stat = 0;
198 198
             $variables['siteSetupChecklist'] = [];
199 199
             foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) {
200
-                $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]);
200
+                $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]);
201 201
                 $variables['siteSetupChecklist'][$setupField] = [
202 202
                     'label' => $setupLabel,
203
-                    'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]),
203
+                    'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]),
204 204
                 ];
205 205
             }
206 206
             foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) {
207
-                $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]);
207
+                $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]);
208 208
                 $variables['siteSetupChecklist'][$setupField] = [
209 209
                     'label' => $setupLabel,
210
-                    'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]),
210
+                    'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]),
211 211
                 ];
212 212
             }
213 213
             $stat = round(($stat / $numFields) * 100);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         $variables['title'] = $templateTitle;
256 256
         $variables['subSectionTitle'] = $subSectionTitle;
257 257
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
258
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
258
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
259 259
         $variables['crumbs'] = [
260 260
             [
261 261
                 'label' => $pluginName,
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
             ],
264 264
             [
265 265
                 'label' => $templateTitle,
266
-                'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri),
266
+                'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri),
267 267
             ],
268 268
             [
269 269
                 'label' => $subSectionTitle,
270
-                'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri),
270
+                'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri),
271 271
             ],
272 272
         ];
273 273
         $variables['selectedSubnavItem'] = 'global';
@@ -275,14 +275,14 @@  discard block
 block discarded – undo
275 275
         $this->setGlobalFieldSourceVariables($variables);
276 276
         // Enabled sites
277 277
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
278
-        $variables['controllerHandle'] = 'global' . '/' . $subSection;
278
+        $variables['controllerHandle'] = 'global'.'/'.$subSection;
279 279
         $variables['currentSubSection'] = $subSection;
280 280
         // Meta bundle settings
281 281
         Seomatic::$previewingMetaContainers = true;
282 282
         // Get the site to copy the settings from, if any
283 283
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
284 284
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
285
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
285
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
286 286
         // Load the metabundle
287 287
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
288 288
         if ($editedMetaBundle) {
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
         // Preview the meta containers
337 337
         Seomatic::$plugin->metaContainers->previewMetaContainers(
338 338
             MetaBundles::GLOBAL_META_BUNDLE,
339
-            (int)$variables['currentSiteId']
339
+            (int) $variables['currentSiteId']
340 340
         );
341 341
 
342 342
         // Render the template
343
-        return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables);
343
+        return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables);
344 344
     }
345 345
 
346 346
     /**
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         $variables['pluginName'] = Seomatic::$settings->pluginName;
473 473
         $variables['title'] = $templateTitle;
474 474
         $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
475
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
475
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
476 476
         $variables['crumbs'] = [
477 477
             [
478 478
                 'label' => $pluginName,
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
             ],
481 481
             [
482 482
                 'label' => $templateTitle,
483
-                'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri),
483
+                'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri),
484 484
             ],
485 485
         ];
486 486
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
         $siteHandle = $this->getCpSiteHandle($siteHandle);
522 522
         $siteId = $this->getSiteIdFromHandle($siteHandle);
523 523
         if (is_string($typeId)) {
524
-            $typeId = (int)$typeId;
524
+            $typeId = (int) $typeId;
525 525
         }
526 526
         // Get the (entry) type menu
527 527
         $typeMenu = [];
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
             $currentType = reset($typeMenu);
537 537
             $variables['currentType'] = $typeMenu[$typeId] ?? $currentType;
538 538
             $variables['currentTypeId'] = $typeId ?? key($typeMenu);
539
-            $typeId = (int)$variables['currentTypeId'];
539
+            $typeId = (int) $variables['currentTypeId'];
540 540
         }
541 541
         // If there's only one EntryType, don't bother displaying the menu
542 542
         if (count($typeMenu) === 1) {
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
         // Get the site to copy the settings from, if any
563 563
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
564 564
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
565
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
565
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
566 566
         // Load the metabundle
567 567
         $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle(
568 568
             $sourceBundleType,
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         $variables['title'] = $templateTitle;
589 589
         $variables['subSectionTitle'] = $subSectionTitle;
590 590
         $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}";
591
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
591
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
592 592
         $variables['siteHandleUri'] = $siteHandleUri;
593 593
         $variables['crumbs'] = [
594 594
             [
@@ -597,10 +597,10 @@  discard block
 block discarded – undo
597 597
             ],
598 598
             [
599 599
                 'label' => 'Content SEO',
600
-                'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri),
600
+                'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri),
601 601
             ],
602 602
             [
603
-                'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle,
603
+                'label' => $metaBundle->sourceName.' · '.$subSectionTitle,
604 604
                 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"),
605 605
             ],
606 606
         ];
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
         // Preview the meta containers
631 631
         Seomatic::$plugin->metaContainers->previewMetaContainers(
632 632
             $uri,
633
-            (int)$variables['currentSiteId'],
633
+            (int) $variables['currentSiteId'],
634 634
             false,
635 635
             false
636 636
         );
637 637
 
638 638
         // Render the template
639
-        return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables);
639
+        return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables);
640 640
     }
641 641
 
642 642
     /**
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
         $bundleSettings = $request->getParam('metaBundleSettings');
658 658
         $sitemapSettings = $request->getParam('metaSitemapVars');
659 659
         if (is_string($typeId)) {
660
-            $typeId = (int)$typeId;
660
+            $typeId = (int) $typeId;
661 661
         }
662 662
         // Set the element type in the template
663 663
         $elementName = '';
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
         if ($subSection === 'social') {
730 730
             $subSectionSuffix = ' Media';
731 731
         }
732
-        $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix);
732
+        $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix);
733 733
         // Asset bundle
734 734
         try {
735 735
             Seomatic::$view->registerAssetBundle(SeomaticAsset::class);
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
         $variables['title'] = $templateTitle;
748 748
         $variables['subSectionTitle'] = $subSectionTitle;
749 749
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
750
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
750
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
751 751
         $variables['crumbs'] = [
752 752
             [
753 753
                 'label' => $pluginName,
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
             ],
756 756
             [
757 757
                 'label' => $templateTitle,
758
-                'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri),
758
+                'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri),
759 759
             ],
760 760
             [
761 761
                 'label' => $subSectionTitle,
762
-                'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri),
762
+                'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri),
763 763
             ],
764 764
         ];
765 765
         $variables['selectedSubnavItem'] = 'site';
@@ -767,14 +767,14 @@  discard block
 block discarded – undo
767 767
 
768 768
         // Enabled sites
769 769
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
770
-        $variables['controllerHandle'] = 'site' . '/' . $subSection;
770
+        $variables['controllerHandle'] = 'site'.'/'.$subSection;
771 771
 
772 772
         // The site settings for the appropriate meta bundle
773 773
         Seomatic::$previewingMetaContainers = true;
774 774
         // Get the site to copy the settings from, if any
775 775
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
776 776
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
777
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
777
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
778 778
         // Load the metabundle
779 779
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
780 780
         Seomatic::$previewingMetaContainers = false;
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
         $variables['elementType'] = Asset::class;
793 793
 
794 794
         // Render the template
795
-        return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables);
795
+        return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables);
796 796
     }
797 797
 
798 798
     /**
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
         $siteId = $this->getSiteIdFromHandle($siteHandle);
925 925
         // Enabled sites
926 926
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
927
-        $variables['controllerHandle'] = 'tracking' . '/' . $subSection;
927
+        $variables['controllerHandle'] = 'tracking'.'/'.$subSection;
928 928
         $variables['currentSubSection'] = $subSection;
929 929
 
930 930
         // The script meta containers for the global meta bundle
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
         // Get the site to copy the settings from, if any
933 933
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
934 934
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
935
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
935
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
936 936
         // Load the metabundle
937 937
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
938 938
         if ($editedMetaBundle) {
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
         $variables['title'] = $templateTitle;
973 973
         $variables['subSectionTitle'] = $subSectionTitle;
974 974
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
975
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
975
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
976 976
         $variables['crumbs'] = [
977 977
             [
978 978
                 'label' => $pluginName,
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
             ],
985 985
             [
986 986
                 'label' => $subSectionTitle,
987
-                'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri),
987
+                'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri),
988 988
             ],
989 989
         ];
990 990
         $variables['selectedSubnavItem'] = 'tracking';
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
         if ($siteHandle !== null) {
1138 1138
             $site = Craft::$app->getSites()->getSiteByHandle($siteHandle);
1139 1139
             if (!$site) {
1140
-                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle);
1140
+                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle);
1141 1141
             }
1142 1142
             $siteId = $site->id;
1143 1143
         } else {
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
                 if (!empty($variables['enabledSiteIds'])) {
1175 1175
                     $siteId = reset($variables['enabledSiteIds']);
1176 1176
                 } else {
1177
-                    $this->requirePermission('editSite:' . $siteId);
1177
+                    $this->requirePermission('editSite:'.$siteId);
1178 1178
                 }
1179 1179
             }
1180 1180
         }
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
         if ($variables['showSites']) {
1195 1195
             $variables['sitesMenuLabel'] = Craft::t(
1196 1196
                 'site',
1197
-                $sites->getSiteById((int)$variables['currentSiteId'])->name
1197
+                $sites->getSiteById((int) $variables['currentSiteId'])->name
1198 1198
             );
1199 1199
         } else {
1200 1200
             $variables['sitesMenuLabel'] = '';
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
                $typeId = null,
1262 1262
     ) {
1263 1263
         $variables['textFieldSources'] = array_merge(
1264
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'],
1264
+            ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'],
1265 1265
             FieldHelper::fieldsOfTypeFromSource(
1266 1266
                 $sourceBundleType,
1267 1267
                 $sourceHandle,
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
             )
1272 1272
         );
1273 1273
         $variables['assetFieldSources'] = array_merge(
1274
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields']],
1274
+            ['entryGroup' => ['optgroup' => $groupName.' Fields']],
1275 1275
             FieldHelper::fieldsOfTypeFromSource(
1276 1276
                 $sourceBundleType,
1277 1277
                 $sourceHandle,
Please login to merge, or discard this patch.