Passed
Push — v3 ( 4358aa...b8a538 )
by Andrew
05:33
created
src/helpers/JsonLd.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $array = self::changeKey($array, 'type', '@type');
90 90
         if ($depth > 1) {
91 91
             foreach (self::IGNORE_ATTRIBUTES as $attribute) {
92
-                unset($array[$attribute]);
92
+                unset($array[ $attribute ]);
93 93
             }
94 94
         }
95 95
         MetaValueHelper::parseArray($array);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             return $array;
113 113
         }
114 114
         $keys = array_keys($array);
115
-        $keys[array_search($oldKey, $keys)] = $newKey;
115
+        $keys[ array_search($oldKey, $keys) ] = $newKey;
116 116
 
117 117
         return array_combine($keys, $array);
118 118
     }
Please login to merge, or discard this patch.
src/helpers/Field.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
         FieldLayout $layout,
78 78
         bool $keysOnly = true
79 79
     ): array {
80
-        $foundFields = [];
81
-        if (!empty(self::FIELD_CLASSES[$fieldClassKey])) {
82
-            $fieldClasses = self::FIELD_CLASSES[$fieldClassKey];
80
+        $foundFields = [ ];
81
+        if (!empty(self::FIELD_CLASSES[ $fieldClassKey ])) {
82
+            $fieldClasses = self::FIELD_CLASSES[ $fieldClassKey ];
83 83
             $fields = $layout->getFields();
84 84
             /** @var  $field BaseField */
85 85
             foreach ($fields as $field) {
86 86
                 foreach ($fieldClasses as $fieldClassKey) {
87 87
                     if ($field instanceof $fieldClassKey) {
88
-                        $foundFields[$field->handle] = $field->name;
88
+                        $foundFields[ $field->handle ] = $field->name;
89 89
                     }
90 90
                 }
91 91
             }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public static function fieldsOfTypeFromAssetVolumes(string $fieldClassKey, bool $keysOnly = true): array
148 148
     {
149
-        $foundFields = [];
149
+        $foundFields = [ ];
150 150
         $volumes = Craft::$app->getVolumes()->getAllVolumes();
151 151
         foreach ($volumes as $volume) {
152 152
             /** @var Volume $volume */
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public static function fieldsOfTypeFromGlobals(string $fieldClassKey, bool $keysOnly = true): array
179 179
     {
180
-        $foundFields = [];
180
+        $foundFields = [ ];
181 181
         $globals = Craft::$app->getGlobals()->getAllSets();
182 182
         foreach ($globals as $global) {
183 183
             $layout = $global->getFieldLayout();
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
                 // Prefix the keys with the global set name
187 187
                 $prefix = $global->handle;
188 188
                 $fields = array_combine(
189
-                    array_map(function ($key) use ($prefix) {
190
-                        return $prefix.'.'.$key;
189
+                    array_map(function($key) use ($prefix) {
190
+                        return $prefix . '.' . $key;
191 191
                     }, array_keys($fields)),
192 192
                     $fields
193 193
                 );
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
         string $fieldClassKey,
220 220
         bool $keysOnly = true
221 221
     ): array {
222
-        $foundFields = [];
223
-        $layouts = [];
222
+        $foundFields = [ ];
223
+        $layouts = [ ];
224 224
         // Get the layouts
225 225
         switch ($sourceBundleType) {
226 226
             case MetaBundles::GLOBAL_META_BUNDLE:
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             case MetaBundles::SECTION_META_BUNDLE:
230 230
                 $entryTypes = Craft::$app->getSections()->getSectionByHandle($sourceHandle)->getEntryTypes();
231 231
                 foreach ($entryTypes as $entryType) {
232
-                    $layouts[] = Craft::$app->getFields()->getLayoutById($entryType->fieldLayoutId);
232
+                    $layouts[ ] = Craft::$app->getFields()->getLayoutById($entryType->fieldLayoutId);
233 233
                 }
234 234
                 break;
235 235
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                     $layoutId = null;
241 241
                 }
242 242
                 if ($layoutId) {
243
-                    $layouts[] = Craft::$app->getFields()->getLayoutById($layoutId);
243
+                    $layouts[ ] = Craft::$app->getFields()->getLayoutById($layoutId);
244 244
                 }
245 245
                 break;
246 246
             // @TODO: handle commerce products
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      */
268 268
     public static function matrixFieldsOfType(MatrixBlock $matrixBlock, string $fieldType, bool $keysOnly = true): array
269 269
     {
270
-        $foundFields = [];
270
+        $foundFields = [ ];
271 271
 
272 272
         try {
273 273
             $matrixBlockTypeModel = $matrixBlock->getType();
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             /** @var  $field BaseField */
280 280
             foreach ($fields as $field) {
281 281
                 if ($field instanceof $fieldType) {
282
-                    $foundFields[$field->handle] = $field->name;
282
+                    $foundFields[ $field->handle ] = $field->name;
283 283
                 }
284 284
             }
285 285
         }
Please login to merge, or discard this patch.
src/helpers/MetaValue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         foreach ($metaArray as $key => $value) {
84 84
             if ($value != null) {
85
-                $metaArray[$key] = self::parseString($value);
85
+                $metaArray[ $key ] = self::parseString($value);
86 86
             }
87 87
         }
88 88
         $metaArray = array_filter($metaArray);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             }
138 138
             if ($reflector) {
139 139
                 $matchedElementType = strtolower($reflector->getShortName());
140
-                self::$templateObjectVars[$matchedElementType] = $element;
140
+                self::$templateObjectVars[ $matchedElementType ] = $element;
141 141
             }
142 142
         }
143 143
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                 $metaValue = Craft::t(
182 182
                     'seomatic',
183 183
                     'Error rendering `{template}` -> {error}',
184
-                    ['template' => $metaValue, 'error' => $e->getMessage()]
184
+                    [ 'template' => $metaValue, 'error' => $e->getMessage() ]
185 185
                 );
186 186
                 Craft::error($metaValue, __METHOD__);
187 187
                 // Restore the template mode
Please login to merge, or discard this patch.
src/controllers/MetaContainerController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         int $siteId = null,
204 204
         bool $asArray = false
205 205
     ): array {
206
-        $result = [];
206
+        $result = [ ];
207 207
 
208 208
         // Load the meta containers and parse our globals
209 209
         Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true);
@@ -211,17 +211,17 @@  discard block
 block discarded – undo
211 211
         // Iterate through the desired $containerKeys
212 212
         foreach ($containerKeys as $containerKey) {
213 213
             if ($asArray) {
214
-                $result[$containerKey] = Seomatic::$plugin->metaContainers->renderContainersArrayByType(
214
+                $result[ $containerKey ] = Seomatic::$plugin->metaContainers->renderContainersArrayByType(
215 215
                     $containerKey
216 216
                 );
217 217
             } else {
218
-                $result[$containerKey] = Seomatic::$plugin->metaContainers->renderContainersByType(
218
+                $result[ $containerKey ] = Seomatic::$plugin->metaContainers->renderContainersByType(
219 219
                     $containerKey
220 220
                 );
221 221
             }
222 222
         }
223 223
         // use "pretty" output in debug mode
224
-        Craft::$app->response->formatters[Response::FORMAT_JSON] = [
224
+        Craft::$app->response->formatters[ Response::FORMAT_JSON ] = [
225 225
             'class' => 'yii\web\JsonResponseFormatter',
226 226
             'prettyPrint' => YII_DEBUG,
227 227
         ];
Please login to merge, or discard this patch.
src/controllers/JsonLdController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function actionGetDecomposedType($schemaType)
63 63
     {
64
-        $result = [];
64
+        $result = [ ];
65 65
         while ($schemaType) {
66
-            $className = 'nystudio107\\seomatic\\models\\jsonld\\'.$schemaType;
66
+            $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $schemaType;
67 67
             if (class_exists($className)) {
68 68
                 try {
69 69
                     $classRef = new \ReflectionClass($className);
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
                     $staticProps = $classRef->getStaticProperties();
75 75
 
76 76
                     foreach ($staticProps as $key => $value) {
77
-                        if ($key[0] == '_') {
77
+                        if ($key[ 0 ] == '_') {
78 78
                             $newKey = ltrim($key, '_');
79
-                            $staticProps[$newKey] = $value;
80
-                            unset($staticProps[$key]);
79
+                            $staticProps[ $newKey ] = $value;
80
+                            unset($staticProps[ $key ]);
81 81
                         }
82 82
                     }
83
-                    $result[$schemaType] = $staticProps;
84
-                    $schemaType = $staticProps['schemaTypeExtends'];
83
+                    $result[ $schemaType ] = $staticProps;
84
+                    $schemaType = $staticProps[ 'schemaTypeExtends' ];
85 85
                     if ($schemaType == "JsonLdType") {
86 86
                         $schemaType = null;
87 87
                     }
Please login to merge, or discard this patch.
src/models/MetaJsonLdContainer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @var MetaJsonLd
39 39
      */
40
-    public $data = [];
40
+    public $data = [ ];
41 41
 
42 42
     // Public Methods
43 43
     // =========================================================================
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                         Seomatic::$view->registerScript(
62 62
                             $jsonLd,
63 63
                             View::POS_END,
64
-                            ['type' => 'application/ld+json']
64
+                            [ 'type' => 'application/ld+json' ]
65 65
                         );
66 66
                         // If `devMode` is enabled, validate the JSON-LD and output any model errors
67 67
                         if (Seomatic::$devMode) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         parent::normalizeContainerData();
88 88
 
89 89
         foreach ($this->data as $key => $config) {
90
-            $this->data[$key] = MetaJsonLd::create($config['type'], $config);
90
+            $this->data[ $key ] = MetaJsonLd::create($config[ 'type' ], $config);
91 91
         }
92 92
     }
93 93
 }
Please login to merge, or discard this patch.
src/models/MetaTagContainer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @var MetaTag
38 38
      */
39
-    public $data = [];
39
+    public $data = [ ];
40 40
 
41 41
     // Public Methods
42 42
     // =========================================================================
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
                             Seomatic::$view->registerMetaTag($config);
57 57
                             // If `devMode` is enabled, validate the Meta Tag and output any model errors
58 58
                             if (Seomatic::$devMode) {
59
-                                $scenario = [];
60
-                                $scenario['default'] = 'error';
61
-                                $scenario['warning'] = 'warning';
59
+                                $scenario = [ ];
60
+                                $scenario[ 'default' ] = 'error';
61
+                                $scenario[ 'warning' ] = 'warning';
62 62
                                 $metaTagModel->debugMetaItem(
63 63
                                     "Tag attribute: ",
64 64
                                     $scenario
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         parent::normalizeContainerData();
80 80
 
81 81
         foreach ($this->data as $key => $config) {
82
-            $this->data[$key] = MetaTag::create($key, $config);
82
+            $this->data[ $key ] = MetaTag::create($key, $config);
83 83
         }
84 84
     }
85 85
 }
Please login to merge, or discard this patch.
src/models/MetaSitemapVars.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      *
33 33
      * @return null|MetaSitemapVars
34 34
      */
35
-    public static function create(array $config = [])
35
+    public static function create(array $config = [ ])
36 36
     {
37 37
         $model = new MetaSitemapVars($config);
38 38
 
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
     /**
81 81
      * @var array
82 82
      */
83
-    public $sitemapImageFieldMap = [];
83
+    public $sitemapImageFieldMap = [ ];
84 84
 
85 85
     /**
86 86
      * @var array
87 87
      */
88
-    public $sitemapVideoFieldMap = [];
88
+    public $sitemapVideoFieldMap = [ ];
89 89
 
90 90
     // Public Methods
91 91
     // =========================================================================
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
                 ],
114 114
                 'string',
115 115
             ],
116
-            [['sitemapPriority'], 'number'],
117
-            [['sitemapLimit'], 'integer'],
118
-            [['sitemapUrls', 'sitemapAssets', 'sitemapAltLinks', 'sitemapFiles'], 'boolean'],
119
-            [['sitemapImageFieldMap', 'sitemapVideoFieldMap'], ArrayValidator::class],
116
+            [ [ 'sitemapPriority' ], 'number' ],
117
+            [ [ 'sitemapLimit' ], 'integer' ],
118
+            [ [ 'sitemapUrls', 'sitemapAssets', 'sitemapAltLinks', 'sitemapFiles' ], 'boolean' ],
119
+            [ [ 'sitemapImageFieldMap', 'sitemapVideoFieldMap' ], ArrayValidator::class ],
120 120
         ];
121 121
     }
122 122
 }
Please login to merge, or discard this patch.
src/models/MetaGlobalVars.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @return null|MetaGlobalVars
36 36
      */
37
-    public static function create(array $config = [])
37
+    public static function create(array $config = [ ])
38 38
     {
39 39
         $model = new MetaGlobalVars($config);
40 40
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     /**
163 163
      * @inheritdoc
164 164
      */
165
-    public function __construct(array $config = [])
165
+    public function __construct(array $config = [ ])
166 166
     {
167 167
         // Unset any deprecated properties
168 168
         //unset($config['siteNamePosition']);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                     'nocache',
237 237
                 ],
238 238
             ],
239
-            [['canonicalUrl'], 'url'],
239
+            [ [ 'canonicalUrl' ], 'url' ],
240 240
         ];
241 241
     }
242 242
 }
Please login to merge, or discard this patch.