Passed
Branch develop (0eb5d9)
by Andrew
06:29
created
src/models/MetaBundle.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * @var array
73 73
      */
74
-    public $sourceAltSiteSettings = [];
74
+    public $sourceAltSiteSettings = [ ];
75 75
 
76 76
     /**
77 77
      * @var \DateTime
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      *
124 124
      * @return null|MetaBundle
125 125
      */
126
-    public static function create($config = [])
126
+    public static function create($config = [ ])
127 127
     {
128 128
         $model = new MetaBundle($config);
129 129
         if ($model) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
         // Meta containers
169 169
         if (!empty($this->metaContainers)) {
170 170
             $metaContainers = $this->metaContainers;
171
-            $this->metaContainers = [];
171
+            $this->metaContainers = [ ];
172 172
             foreach ($metaContainers as $key => $metaContainer) {
173 173
                 /** @var MetaContainer $containerClass */
174
-                $containerClass = $metaContainer['class'];
174
+                $containerClass = $metaContainer[ 'class' ];
175 175
                 /**  @var array $metaContainer */
176
-                $this->metaContainers[$key] = $containerClass::create($metaContainer);
176
+                $this->metaContainers[ $key ] = $containerClass::create($metaContainer);
177 177
             }
178 178
         }
179 179
         // Redirects container
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     public function datetimeAttributes(): array
193 193
     {
194 194
         $names = parent::datetimeAttributes();
195
-        $names[] = 'sourceDateUpdated';
195
+        $names[ ] = 'sourceDateUpdated';
196 196
 
197 197
         return $names;
198 198
     }
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
                 ],
229 229
                 'string',
230 230
             ],
231
-            [['sourceId', 'sourceSiteId'], 'number', 'min' => 1],
232
-            [['sourceDateUpdated'], DateTimeValidator::class],
233
-            [['sourceTemplate', 'sourceAltSiteSettings'], 'safe'],
231
+            [ [ 'sourceId', 'sourceSiteId' ], 'number', 'min' => 1 ],
232
+            [ [ 'sourceDateUpdated' ], DateTimeValidator::class ],
233
+            [ [ 'sourceTemplate', 'sourceAltSiteSettings' ], 'safe' ],
234 234
         ];
235 235
         return $rules;
236 236
     }
Please login to merge, or discard this patch.
src/models/SitemapIndexTemplate.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      *
46 46
      * @return null|SitemapIndexTemplate
47 47
      */
48
-    public static function create(array $config = [])
48
+    public static function create(array $config = [ ])
49 49
     {
50 50
         $defaults = [
51 51
             'path'       => 'sitemaps/<groupId:\d+>/sitemap.xml',
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
      *
95 95
      * @throws NotFoundHttpException if the sitemap.xml doesn't exist
96 96
      */
97
-    public function render($params = []): string
97
+    public function render($params = [ ]): string
98 98
     {
99 99
         $cache = Craft::$app->getCache();
100
-        $groupId = $params['groupId'];
100
+        $groupId = $params[ 'groupId' ];
101 101
         /** @var SiteGroup $siteGroup */
102 102
         $siteGroup = Craft::$app->getSites()->getGroupById($groupId);
103 103
         $groupSiteIds = $siteGroup->getSiteIds();
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
                 ],
111 111
             ]);
112 112
 
113
-            return $cache->getOrSet($this::CACHE_KEY.$groupId, function () use ($groupSiteIds) {
113
+            return $cache->getOrSet($this::CACHE_KEY . $groupId, function() use ($groupSiteIds) {
114 114
                 Craft::info(
115 115
                     'Sitemap index cache miss',
116 116
                     __METHOD__
117 117
                 );
118
-                $lines = [];
118
+                $lines = [ ];
119 119
                 // Sitemap index XML header and opening tag
120
-                $lines[] = '<?xml version="1.0" encoding="UTF-8"?>';
121
-                $lines[] = '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
120
+                $lines[ ] = '<?xml version="1.0" encoding="UTF-8"?>';
121
+                $lines[ ] = '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
122 122
                 // One sitemap entry for each MeteBundle
123 123
                 $metaBundles = Seomatic::$plugin->metaBundles->getContentMetaBundles(true);
124 124
                 /** @var  $metaBundle MetaBundle */
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
                             $metaBundle->sourceHandle,
130 130
                             $metaBundle->sourceSiteId
131 131
                         );
132
-                        $lines[] = '  <sitemap>';
133
-                        $lines[] = '    <loc>';
134
-                        $lines[] = '      '.$sitemapUrl;
135
-                        $lines[] = '    </loc>';
132
+                        $lines[ ] = '  <sitemap>';
133
+                        $lines[ ] = '    <loc>';
134
+                        $lines[ ] = '      ' . $sitemapUrl;
135
+                        $lines[ ] = '    </loc>';
136 136
                         if (!empty($metaBundle->sourceDateUpdated)) {
137
-                            $lines[] = '    <lastmod>';
138
-                            $lines[] = '      '.$metaBundle->sourceDateUpdated->format(\DateTime::W3C);
139
-                            $lines[] = '    </lastmod>';
137
+                            $lines[ ] = '    <lastmod>';
138
+                            $lines[ ] = '      ' . $metaBundle->sourceDateUpdated->format(\DateTime::W3C);
139
+                            $lines[ ] = '    </lastmod>';
140 140
                         }
141
-                        $lines[] = '  </sitemap>';
141
+                        $lines[ ] = '  </sitemap>';
142 142
                     }
143 143
                 }
144 144
                 // Sitemap index closing tag
145
-                $lines[] = '</sitemapindex>';
145
+                $lines[ ] = '</sitemapindex>';
146 146
 
147 147
                 return implode("\r\n", $lines);
148 148
             }, $duration, $dependency);
Please login to merge, or discard this patch.
src/models/MetaScriptContainer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      *
39 39
      * @var MetaScript
40 40
      */
41
-    public $data = [];
41
+    public $data = [ ];
42 42
 
43 43
     /**
44 44
      * @var int
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         parent::normalizeContainerData();
82 82
 
83 83
         foreach ($this->data as $key => $config) {
84
-            $this->data[$key] = MetaScript::create($config);
84
+            $this->data[ $key ] = MetaScript::create($config);
85 85
         }
86 86
     }
87 87
 }
Please login to merge, or discard this patch.
src/models/MetaJsonLd.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -71,35 +71,35 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @var array
73 73
      */
74
-    static public $schemaPropertyNames = [];
74
+    static public $schemaPropertyNames = [ ];
75 75
 
76 76
     /**
77 77
      * The Schema.org Property Expected Types
78 78
      *
79 79
      * @var array
80 80
      */
81
-    static public $schemaPropertyExpectedTypes = [];
81
+    static public $schemaPropertyExpectedTypes = [ ];
82 82
 
83 83
     /**
84 84
      * The Schema.org Property Descriptions
85 85
      *
86 86
      * @var array
87 87
      */
88
-    static public $schemaPropertyDescriptions = [];
88
+    static public $schemaPropertyDescriptions = [ ];
89 89
 
90 90
     /**
91 91
      * The Schema.org Google Required Schema for this type
92 92
      *
93 93
      * @var array
94 94
      */
95
-    static public $googleRequiredSchema = [];
95
+    static public $googleRequiredSchema = [ ];
96 96
 
97 97
     /**
98 98
      * The Schema.org Google Recommended Schema for this type
99 99
      *
100 100
      * @var array
101 101
      */
102
-    static public $googleRecommendedSchema = [];
102
+    static public $googleRecommendedSchema = [ ];
103 103
 
104 104
     // Public Properties
105 105
     // =========================================================================
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @return MetaJsonLd
174 174
      */
175
-    public static function create($schemaType, $config = []): MetaJsonLd
175
+    public static function create($schemaType, $config = [ ]): MetaJsonLd
176 176
     {
177 177
         $model = null;
178 178
         $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $schemaType;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
             $linebreak = '';
252 252
             // If we're rendering for an array, don't add linebreaks
253 253
             $oldDevMode = Seomatic::$devMode;
254
-            if ($params['array'] === true) {
254
+            if ($params[ 'array' ] === true) {
255 255
                 Seomatic::$devMode = false;
256 256
             }
257 257
             // If `devMode` is enabled, make the JSON-LD human-readable
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
             $this->setScenario('render');
264 264
             $html = JsonLdHelper::encode($this);
265 265
             $this->setScenario($scenario);
266
-            if ($params['array'] === true) {
266
+            if ($params[ 'array' ] === true) {
267 267
                 Seomatic::$devMode = $oldDevMode;
268 268
             }
269
-            if ($params['renderScriptTags']) {
269
+            if ($params[ 'renderScriptTags' ]) {
270 270
                 $html =
271 271
                     '<script type="application/ld+json">'
272 272
                     . $linebreak
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                     . $html
280 280
                     . $linebreak;
281 281
             }
282
-            if ($params['renderRaw'] === true) {
282
+            if ($params[ 'renderRaw' ] === true) {
283 283
                 $html = Template::raw($html);
284 284
             }
285 285
         }
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
     /**
291 291
      * @inheritdoc
292 292
      */
293
-    public function renderAttributes($params = []): array
293
+    public function renderAttributes($params = [ ]): array
294 294
     {
295
-        $attributes = [];
295
+        $attributes = [ ];
296 296
 
297 297
         $result = Json::decodeIfJson($this->render([
298 298
             'renderRaw'        => true,
@@ -347,11 +347,11 @@  discard block
 block discarded – undo
347 347
         if (!in_array($attribute, static::$schemaPropertyNames)) {
348 348
             $this->addError($attribute, 'The attribute does not exist.');
349 349
         } else {
350
-            $expectedTypes = static::$schemaPropertyExpectedTypes[$attribute];
350
+            $expectedTypes = static::$schemaPropertyExpectedTypes[ $attribute ];
351 351
             $validated = false;
352 352
             $dataToValidate = $this->$attribute;
353 353
             if (!is_array($dataToValidate)) {
354
-                $dataToValidate = [$dataToValidate];
354
+                $dataToValidate = [ $dataToValidate ];
355 355
             }
356 356
             foreach ($dataToValidate as $data) {
357 357
                 foreach ($expectedTypes as $expectedType) {
Please login to merge, or discard this patch.
src/models/MetaSiteVars.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @return null|MetaSiteVars
39 39
      */
40
-    public static function create(array $config = [])
40
+    public static function create(array $config = [ ])
41 41
     {
42 42
         $model = new MetaSiteVars($config);
43 43
         if ($model) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * @var array Array of links for Same As... sites, indexed by the handle
100 100
      */
101
-    public $sameAsLinks = [];
101
+    public $sameAsLinks = [ ];
102 102
 
103 103
     // Public Methods
104 104
     // =========================================================================
Please login to merge, or discard this patch.
src/models/MetaLink.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      *
46 46
      * @return MetaLink
47 47
      */
48
-    public static function create(array $config = []): MetaLink
48
+    public static function create(array $config = [ ]): MetaLink
49 49
     {
50 50
         foreach ($config as $key => $value) {
51 51
             ArrayHelper::rename($config, $key, Inflector::variablize($key));
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $rules = parent::rules();
116 116
         $rules = array_merge($rules, [
117
-            [['crossorigin', 'href', 'hreflang', 'media', 'rel', 'sizes', 'type'], 'string'],
118
-            ['crossorigin', 'in', 'range' => [
117
+            [ [ 'crossorigin', 'href', 'hreflang', 'media', 'rel', 'sizes', 'type' ], 'string' ],
118
+            [ 'crossorigin', 'in', 'range' => [
119 119
                 'anonymous',
120 120
                 'use-credentials'
121
-            ]],
122
-            ['href', 'url'],
123
-            ['hreflang', 'string'],
124
-            ['rel', 'required'],
125
-            ['rel', 'in', 'range' => [
121
+            ] ],
122
+            [ 'href', 'url' ],
123
+            [ 'hreflang', 'string' ],
124
+            [ 'rel', 'required' ],
125
+            [ 'rel', 'in', 'range' => [
126 126
                 'alternate',
127 127
                 'author',
128 128
                 'canonical',
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                 'publisher',
142 142
                 'search',
143 143
                 'stylesheet',
144
-            ]],
144
+            ] ],
145 145
         ]);
146 146
 
147 147
         return $rules;
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                 $error = Craft::t(
177 177
                     'seomatic',
178 178
                     '{tagtype} tag `{key}` did not render because it is missing attributes.',
179
-                    ['tagtype' => 'Link', 'key' => $this->key]
179
+                    [ 'tagtype' => 'Link', 'key' => $this->key ]
180 180
                 );
181 181
                 Craft::error($error, __METHOD__);
182 182
                 $shouldRender = false;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     /**
190 190
      * @inheritdoc
191 191
      */
192
-    public function render($params = []):string
192
+    public function render($params = [ ]):string
193 193
     {
194 194
         $html = '';
195 195
         $configs = $this->tagAttributesArray();
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
     /**
207 207
      * @inheritdoc
208 208
      */
209
-    public function renderAttributes($params = []): array
209
+    public function renderAttributes($params = [ ]): array
210 210
     {
211
-        $attributes = [];
211
+        $attributes = [ ];
212 212
 
213 213
         $configs = $this->tagAttributesArray();
214 214
         foreach ($configs as $config) {
Please login to merge, or discard this patch.
src/models/MetaScript.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      *
39 39
      * @return MetaScript
40 40
      */
41
-    public static function create(array $config = []): MetaScript
41
+    public static function create(array $config = [ ]): MetaScript
42 42
     {
43 43
         $model = new MetaScript($config);
44 44
         // Load $templateString from the source template if it's not set
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 ],
163 163
                 'required'
164 164
             ],
165
-            [['vars'], 'safe'],
165
+            [ [ 'vars' ], 'safe' ],
166 166
         ]);
167 167
 
168 168
         return $rules;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      *
211 211
      * @return string
212 212
      */
213
-    public function renderBodyHtml($params = []):string
213
+    public function renderBodyHtml($params = [ ]):string
214 214
     {
215 215
         $html = '';
216 216
         if (!empty($this->bodyTemplatePath)) {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     /**
226 226
      * @inheritdoc
227 227
      */
228
-    public function render($params = []):string
228
+    public function render($params = [ ]):string
229 229
     {
230 230
         $html = '';
231 231
         if ($this->prepForRender($params)) {
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
     /**
239 239
      * @inheritdoc
240 240
      */
241
-    public function renderAttributes($params = []): array
241
+    public function renderAttributes($params = [ ]): array
242 242
     {
243
-        $attributes = [];
243
+        $attributes = [ ];
244 244
 
245 245
         if ($this->prepForRender($options)) {
246
-            $attributes = ['script' => PluginTemplateHelper::renderStringTemplate($this->templateString, $this->vars)];
246
+            $attributes = [ 'script' => PluginTemplateHelper::renderStringTemplate($this->templateString, $this->vars) ];
247 247
         }
248 248
 
249 249
         return $attributes;
Please login to merge, or discard this patch.
src/models/FrontendTemplateContainer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @var EditableTemplate
30 30
      */
31
-    public $data = [];
31
+    public $data = [ ];
32 32
 
33 33
     // Public Methods
34 34
     // =========================================================================
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     /**
37 37
      * @inheritdoc
38 38
      */
39
-    public function render($params = []): string
39
+    public function render($params = [ ]): string
40 40
     {
41 41
         return '';
42 42
     }
Please login to merge, or discard this patch.
src/models/EditableTemplate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @return null|EditableTemplate
39 39
      */
40
-    public static function create(array $config = [])
40
+    public static function create(array $config = [ ])
41 41
     {
42 42
         $model = new EditableTemplate($config);
43 43
         // Load $templateString from the source template if it's not set
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
     {
102 102
         $rules = parent::rules();
103 103
         $rules = array_merge($rules, [
104
-            [['templateString'], 'required'],
105
-            [['templateString'], 'string'],
104
+            [ [ 'templateString' ], 'required' ],
105
+            [ [ 'templateString' ], 'string' ],
106 106
         ]);
107 107
 
108 108
         return $rules;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     /**
112 112
      * @inheritdoc
113 113
      */
114
-    public function render($params = []): string
114
+    public function render($params = [ ]): string
115 115
     {
116 116
         $html = PluginTemplateHelper::renderStringTemplate($this->templateString);
117 117
 
Please login to merge, or discard this patch.