Test Failed
Push — v4 ( 40e661...e320c9 )
by Andrew
44:16 queued 21:15
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
         if (empty($typeId)) {
527 527
             $typeId = null;
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
             $currentType = reset($typeMenu);
540 540
             $variables['currentType'] = $typeMenu[$typeId] ?? $currentType;
541 541
             $variables['currentTypeId'] = $typeId ?? key($typeMenu);
542
-            $typeId = (int)$variables['currentTypeId'];
542
+            $typeId = (int) $variables['currentTypeId'];
543 543
         }
544 544
         // If there's only one EntryType, don't bother displaying the menu
545 545
         if (count($typeMenu) === 1) {
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         // Get the site to copy the settings from, if any
572 572
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
573 573
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
574
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
574
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
575 575
         // Load the metabundle
576 576
         $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle(
577 577
             $sourceBundleType,
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
         $variables['title'] = $templateTitle;
598 598
         $variables['subSectionTitle'] = $subSectionTitle;
599 599
         $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}";
600
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
600
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
601 601
         $variables['siteHandleUri'] = $siteHandleUri;
602 602
         $variables['crumbs'] = [
603 603
             [
@@ -606,10 +606,10 @@  discard block
 block discarded – undo
606 606
             ],
607 607
             [
608 608
                 'label' => 'Content SEO',
609
-                'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri),
609
+                'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri),
610 610
             ],
611 611
             [
612
-                'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle,
612
+                'label' => $metaBundle->sourceName.' · '.$subSectionTitle,
613 613
                 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"),
614 614
             ],
615 615
         ];
@@ -639,13 +639,13 @@  discard block
 block discarded – undo
639 639
         // Preview the meta containers
640 640
         Seomatic::$plugin->metaContainers->previewMetaContainers(
641 641
             $uri,
642
-            (int)$variables['currentSiteId'],
642
+            (int) $variables['currentSiteId'],
643 643
             false,
644 644
             false
645 645
         );
646 646
 
647 647
         // Render the template
648
-        return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables);
648
+        return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables);
649 649
     }
650 650
 
651 651
     /**
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
         $bundleSettings = $request->getParam('metaBundleSettings');
667 667
         $sitemapSettings = $request->getParam('metaSitemapVars');
668 668
         if (is_string($typeId)) {
669
-            $typeId = (int)$typeId;
669
+            $typeId = (int) $typeId;
670 670
         }
671 671
         // Set the element type in the template
672 672
         $elementName = '';
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         if ($subSection === 'social') {
739 739
             $subSectionSuffix = ' Media';
740 740
         }
741
-        $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix);
741
+        $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix);
742 742
         // Asset bundle
743 743
         try {
744 744
             Seomatic::$view->registerAssetBundle(SeomaticAsset::class);
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
         $variables['title'] = $templateTitle;
757 757
         $variables['subSectionTitle'] = $subSectionTitle;
758 758
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
759
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
759
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
760 760
         $variables['crumbs'] = [
761 761
             [
762 762
                 'label' => $pluginName,
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
             ],
765 765
             [
766 766
                 'label' => $templateTitle,
767
-                'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri),
767
+                'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri),
768 768
             ],
769 769
             [
770 770
                 'label' => $subSectionTitle,
771
-                'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri),
771
+                'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri),
772 772
             ],
773 773
         ];
774 774
         $variables['selectedSubnavItem'] = 'site';
@@ -776,14 +776,14 @@  discard block
 block discarded – undo
776 776
 
777 777
         // Enabled sites
778 778
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
779
-        $variables['controllerHandle'] = 'site' . '/' . $subSection;
779
+        $variables['controllerHandle'] = 'site'.'/'.$subSection;
780 780
 
781 781
         // The site settings for the appropriate meta bundle
782 782
         Seomatic::$previewingMetaContainers = true;
783 783
         // Get the site to copy the settings from, if any
784 784
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
785 785
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
786
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
786
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
787 787
         // Load the metabundle
788 788
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
789 789
         Seomatic::$previewingMetaContainers = false;
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
         $variables['elementType'] = Asset::class;
802 802
 
803 803
         // Render the template
804
-        return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables);
804
+        return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables);
805 805
     }
806 806
 
807 807
     /**
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
         $siteId = $this->getSiteIdFromHandle($siteHandle);
934 934
         // Enabled sites
935 935
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
936
-        $variables['controllerHandle'] = 'tracking' . '/' . $subSection;
936
+        $variables['controllerHandle'] = 'tracking'.'/'.$subSection;
937 937
         $variables['currentSubSection'] = $subSection;
938 938
 
939 939
         // The script meta containers for the global meta bundle
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         // Get the site to copy the settings from, if any
942 942
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
943 943
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
944
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
944
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
945 945
         // Load the metabundle
946 946
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
947 947
         if ($editedMetaBundle) {
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
         $variables['title'] = $templateTitle;
982 982
         $variables['subSectionTitle'] = $subSectionTitle;
983 983
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
984
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
984
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
985 985
         $variables['crumbs'] = [
986 986
             [
987 987
                 'label' => $pluginName,
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
             ],
994 994
             [
995 995
                 'label' => $subSectionTitle,
996
-                'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri),
996
+                'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri),
997 997
             ],
998 998
         ];
999 999
         $variables['selectedSubnavItem'] = 'tracking';
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
         if ($siteHandle !== null) {
1147 1147
             $site = Craft::$app->getSites()->getSiteByHandle($siteHandle);
1148 1148
             if (!$site) {
1149
-                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle);
1149
+                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle);
1150 1150
             }
1151 1151
             $siteId = $site->id;
1152 1152
         } else {
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
                 if (!empty($variables['enabledSiteIds'])) {
1184 1184
                     $siteId = reset($variables['enabledSiteIds']);
1185 1185
                 } else {
1186
-                    $this->requirePermission('editSite:' . $siteId);
1186
+                    $this->requirePermission('editSite:'.$siteId);
1187 1187
                 }
1188 1188
             }
1189 1189
         }
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
         if ($variables['showSites']) {
1204 1204
             $variables['sitesMenuLabel'] = Craft::t(
1205 1205
                 'site',
1206
-                $sites->getSiteById((int)$variables['currentSiteId'])->name
1206
+                $sites->getSiteById((int) $variables['currentSiteId'])->name
1207 1207
             );
1208 1208
         } else {
1209 1209
             $variables['sitesMenuLabel'] = '';
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
                $typeId = null,
1271 1271
     ) {
1272 1272
         $variables['textFieldSources'] = array_merge(
1273
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'],
1273
+            ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'],
1274 1274
             FieldHelper::fieldsOfTypeFromSource(
1275 1275
                 $sourceBundleType,
1276 1276
                 $sourceHandle,
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
             )
1281 1281
         );
1282 1282
         $variables['assetFieldSources'] = array_merge(
1283
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields']],
1283
+            ['entryGroup' => ['optgroup' => $groupName.' Fields']],
1284 1284
             FieldHelper::fieldsOfTypeFromSource(
1285 1285
                 $sourceBundleType,
1286 1286
                 $sourceHandle,
Please login to merge, or discard this patch.