Passed
Branch develop (0eb5d9)
by Andrew
06:29
created
src/helpers/DynamicMeta.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
                     'name' => $element->title,
91 91
                 ],
92 92
             ]);
93
-            $crumbs->itemListElement[] = $listItem;
93
+            $crumbs->itemListElement[ ] = $listItem;
94 94
         } else {
95
-            $crumbs->itemListElement[] = MetaJsonLd::create("ListItem", [
95
+            $crumbs->itemListElement[ ] = MetaJsonLd::create("ListItem", [
96 96
                 'position' => $position,
97 97
                 'item'     => [
98 98
                     '@id'  => $siteUrl,
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                     $id = $siteUrl;
127 127
                     Craft::error($e->getMessage(), __METHOD__);
128 128
                 }
129
-                $crumbs->itemListElement[] = MetaJsonLd::create("ListItem", [
129
+                $crumbs->itemListElement[ ] = MetaJsonLd::create("ListItem", [
130 130
                     'position' => $position,
131 131
                     'item'     => [
132 132
                         '@id'  => $id,
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
         $sites = self::getLocalizedUrls();
150 150
 
151 151
         // Add the x-default hreflang
152
-        $site = $sites[0];
152
+        $site = $sites[ 0 ];
153 153
         $metaTag = Seomatic::$plugin->link->create([
154 154
             'rel'      => 'alternate',
155 155
             'hreflang' => 'x-default',
156
-            'href'     => $site['url'],
156
+            'href'     => $site[ 'url' ],
157 157
         ]);
158 158
         Seomatic::$plugin->link->add($metaTag);
159 159
         // Add the alternate language link rel's
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
             foreach ($sites as $site) {
162 162
                 $metaTag = Seomatic::$plugin->link->create([
163 163
                     'rel'      => 'alternate',
164
-                    'hreflang' => $site['language'],
165
-                    'href'     => $site['url'],
164
+                    'hreflang' => $site[ 'language' ],
165
+                    'href'     => $site[ 'url' ],
166 166
                 ]);
167 167
                 Seomatic::$plugin->link->add($metaTag);
168 168
             }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public static function getLocalizedUrls()
192 192
     {
193
-        $localizedUrls = [];
193
+        $localizedUrls = [ ];
194 194
         try {
195 195
             $requestUri = Craft::$app->getRequest()->getUrl();
196 196
         } catch (InvalidConfigException $e) {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $language = $site->language;
229 229
             $language = strtolower($language);
230 230
             $language = str_replace('_', '-', $language);
231
-            $localizedUrls[] = [
231
+            $localizedUrls[ ] = [
232 232
                 'id' => $site->id,
233 233
                 'language' => $language,
234 234
                 'url' => $url
Please login to merge, or discard this patch.
src/helpers/PluginTemplate.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     // Static Methods
29 29
     // =========================================================================
30 30
 
31
-    public static function renderStringTemplate(string $templateString, array $params = []): string
31
+    public static function renderStringTemplate(string $templateString, array $params = [ ]): string
32 32
     {
33 33
         try {
34 34
             $html = Seomatic::$view->renderString($templateString, $params);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             $html = Craft::t(
37 37
                 'seomatic',
38 38
                 'Error rendering template string -> {error}',
39
-                ['error' => $e->getMessage()]
39
+                [ 'error' => $e->getMessage() ]
40 40
             );
41 41
             Craft::error($html, __METHOD__);
42 42
         }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return string
54 54
      */
55
-    public static function renderPluginTemplate(string $templatePath, array $params = []): string
55
+    public static function renderPluginTemplate(string $templatePath, array $params = [ ]): string
56 56
     {
57 57
         $templateRendered = false;
58 58
         // Stash the old template mode, and set it AdminCP template mode
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             $htmlText = Craft::t(
72 72
                 'seomatic',
73 73
                 'Error rendering `{template}` -> {error}',
74
-                ['template' => $templatePath, 'error' => $e->getMessage()]
74
+                [ 'template' => $templatePath, 'error' => $e->getMessage() ]
75 75
             );
76 76
             Craft::error($htmlText, __METHOD__);
77 77
             $templateRendered = false;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 $htmlText = Craft::t(
93 93
                     'seomatic',
94 94
                     'Error rendering `{template}` -> {error}',
95
-                    ['template' => $templatePath, 'error' => $e->getMessage()]
95
+                    [ 'template' => $templatePath, 'error' => $e->getMessage() ]
96 96
                 );
97 97
                 Craft::error($htmlText, __METHOD__);
98 98
                 $templateRendered = false;
Please login to merge, or discard this patch.
src/helpers/Text.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         // Iterate through all of the matrix blocks
80 80
         $tags = $tagQuery->all();
81 81
         foreach ($tags as $tag) {
82
-            $result .= $tag->title.", ";
82
+            $result .= $tag->title . ", ";
83 83
         }
84 84
         $result = rtrim($result, ", ");
85 85
 
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
             }
109 109
             // Find any text fields inside of the matrix block
110 110
             if ($matrixBlockTypeModel) {
111
-                $fieldClasses = FieldHelper::FIELD_CLASSES[FieldHelper::TEXT_FIELD_CLASS_KEY];
111
+                $fieldClasses = FieldHelper::FIELD_CLASSES[ FieldHelper::TEXT_FIELD_CLASS_KEY ];
112 112
                 $fields = $matrixBlockTypeModel->getFields();
113 113
 
114 114
                 foreach ($fields as $field) {
115 115
                     foreach ($fieldClasses as $fieldClassKey) {
116 116
                         if ($field instanceof $fieldClassKey) {
117 117
                             if ($field->handle == $fieldHandle || empty($fieldHandle)) {
118
-                                $result .= self::extractTextFromField($block[$field->handle]).' ';
118
+                                $result .= self::extractTextFromField($block[ $field->handle ]) . ' ';
119 119
                             }
120 120
                         }
121 121
                     }
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
     protected static function stopWordsForLanguage(string $language)
238 238
     {
239 239
         $stopWords = null;
240
-        if (!empty(self::LANGUAGE_MAP[$language])) {
241
-            $language = self::LANGUAGE_MAP[$language];
240
+        if (!empty(self::LANGUAGE_MAP[ $language ])) {
241
+            $language = self::LANGUAGE_MAP[ $language ];
242 242
         } else {
243 243
             $language = 'English';
244 244
         }
245 245
 
246
-        $className = 'PhpScience\\TextRank\\Tool\\StopWords\\'.ucfirst($language);
246
+        $className = 'PhpScience\\TextRank\\Tool\\StopWords\\' . ucfirst($language);
247 247
         if (class_exists($className)) {
248 248
             $stopWords = new $className;
249 249
         }
Please login to merge, or discard this patch.
src/helpers/ArrayHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
     {
32 32
         foreach ($array as $k => $v) {
33 33
             if (is_array($v)) {
34
-                $array[$k] = self::arrayFilterRecursive($v, $callback);
34
+                $array[ $k ] = self::arrayFilterRecursive($v, $callback);
35 35
             } else {
36 36
                 if ($callback($v, $k)) {
37
-                    unset($array[$k]);
37
+                    unset($array[ $k ]);
38 38
                 }
39 39
             }
40 40
         }
Please login to merge, or discard this patch.
src/helpers/Config.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
             // Now try our own internal config
49 49
             $path = self::getConfigFilePath('@nystudio107/seomatic', $filePath);
50 50
             if (!file_exists($path)) {
51
-                return [];
51
+                return [ ];
52 52
             }
53 53
         }
54 54
 
55 55
         if (!is_array($config = @include $path)) {
56
-            return [];
56
+            return [ ];
57 57
         }
58 58
 
59 59
         // If it's not a multi-environment config, return the whole thing
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 
64 64
         // If no environment was specified, just look in the '*' array
65 65
         if (Seomatic::$settings->environment === null) {
66
-            return $config['*'];
66
+            return $config[ '*' ];
67 67
         }
68 68
 
69
-        $mergedConfig = [];
69
+        $mergedConfig = [ ];
70 70
         foreach ($config as $env => $envConfig) {
71 71
             if ($env === '*' || StringHelper::contains(Seomatic::$settings->environment, $env)) {
72 72
                 $mergedConfig = ArrayHelper::merge($mergedConfig, $envConfig);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public static function getMergedConfigFromFiles(array $filePaths): array
87 87
     {
88
-        $mergedConfig = [];
88
+        $mergedConfig = [ ];
89 89
         foreach ($filePaths as $filePath) {
90 90
             $mergedConfig = ArrayHelper::merge($mergedConfig, self::getConfigFromFile($filePath));
91 91
         }
Please login to merge, or discard this patch.
src/helpers/ImageTransform.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,8 +67,8 @@
 block discarded – undo
67 67
     {
68 68
         $url = '';
69 69
         $config = array_merge(
70
-            self::$transforms['base'],
71
-            self::$transforms[$transformName] ?? self::$transforms['base']
70
+            self::$transforms[ 'base' ],
71
+            self::$transforms[ $transformName ] ?? self::$transforms[ 'base' ]
72 72
         );
73 73
         $transform = new AssetTransform($config);
74 74
         if (is_int($asset)) {
Please login to merge, or discard this patch.
src/helpers/Dependency.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                 case self::CONFIG_DEPENDENCY:
54 54
                     foreach ($keys as $key) {
55 55
                         // If any value is in the $config[$key] it validates
56
-                        if (!empty($config[$key])) {
56
+                        if (!empty($config[ $key ])) {
57 57
                             $validates = true;
58 58
                         }
59 59
                     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 case self::SITE_DEPENDENCY:
63 63
                     foreach ($keys as $key) {
64 64
                         // If any value is in the $site[$key] it validates
65
-                        if (!empty($site[$key])) {
65
+                        if (!empty($site[ $key ])) {
66 66
                             $validates = true;
67 67
                         }
68 68
                     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 case self::META_DEPENDENCY:
72 72
                     foreach ($keys as $key) {
73 73
                         // If any value is in the $meta[$key] it validates
74
-                        if (!empty($meta[$key])) {
74
+                        if (!empty($meta[ $key ])) {
75 75
                             $validates = true;
76 76
                         }
77 77
                     }
Please login to merge, or discard this patch.
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.