Passed
Pull Request — v3 (#27)
by Rias
05:55
created
src/models/MetaLinkContainer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @var MetaLink
36 36
      */
37
-    public $data = [];
37
+    public $data = [ ];
38 38
 
39 39
     // Public Methods
40 40
     // =========================================================================
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         parent::normalizeContainerData();
74 74
 
75 75
         foreach ($this->data as $key => $config) {
76
-            $this->data[$key] = MetaLink::create($config);
76
+            $this->data[ $key ] = MetaLink::create($config);
77 77
         }
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
src/models/MetaTitleContainer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @var MetaTitle
36 36
      */
37
-    public $data = [];
37
+    public $data = [ ];
38 38
 
39 39
     // Public Methods
40 40
     // =========================================================================
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
                         Seomatic::$view->title = $title;
54 54
                         // If `devMode` is enabled, validate the Meta Tag and output any model errors
55 55
                         if (Seomatic::$devMode) {
56
-                            $scenario = [];
57
-                            $scenario['default'] = 'error';
58
-                            $scenario['warning'] = 'warning';
56
+                            $scenario = [ ];
57
+                            $scenario[ 'default' ] = 'error';
58
+                            $scenario[ 'warning' ] = 'warning';
59 59
                             $metaTitleModel->debugMetaItem(
60 60
                                 "Tag attribute: ",
61 61
                                 $scenario
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         parent::normalizeContainerData();
76 76
 
77 77
         foreach ($this->data as $key => $config) {
78
-            $this->data[$key] = MetaTitle::create($config);
78
+            $this->data[ $key ] = MetaTitle::create($config);
79 79
         }
80 80
     }
81 81
 }
Please login to merge, or discard this patch.
src/models/MetaTitle.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      *
40 40
      * @return MetaTitle
41 41
      */
42
-    public static function create(array $config = []): MetaTitle
42
+    public static function create(array $config = [ ]): MetaTitle
43 43
     {
44 44
         $model = new MetaTitle($config);
45 45
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $rules = parent::rules();
93 93
         $rules = array_merge($rules, [
94
-            [['title'], 'required'],
95
-            [['title'], 'string', 'length' => [40, Seomatic::$settings->maxTitleLength], 'on' => ['warning']],
94
+            [ [ 'title' ], 'required' ],
95
+            [ [ 'title' ], 'string', 'length' => [ 40, Seomatic::$settings->maxTitleLength ], 'on' => [ 'warning' ] ],
96 96
         ]);
97 97
 
98 98
         return $rules;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                     $suffix = '';
150 150
                     break;
151 151
             }
152
-            $lengthAdjust = mb_strlen($prefix.$suffix);
152
+            $lengthAdjust = mb_strlen($prefix . $suffix);
153 153
             // Parse the data
154 154
             $scenario = $this->scenario;
155 155
             $this->setScenario('render');
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                 Seomatic::$settings->maxTitleLength - $lengthAdjust,
161 161
                 '…'
162 162
             );
163
-            $data = $prefix.$data.$suffix;
163
+            $data = $prefix . $data . $suffix;
164 164
             // devMode
165 165
             if (Seomatic::$devMode) {
166 166
                 $data = Seomatic::$settings->devModeTitlePrefix . $data;
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
     /**
174 174
      * @inheritdoc
175 175
      */
176
-    public function render($params = []):string
176
+    public function render($params = [ ]):string
177 177
     {
178 178
         $html = '';
179 179
         $title = $this->title;
180 180
         if ($this->prepForRender($title)) {
181
-            $html = Html::tag('title', $title, []);
181
+            $html = Html::tag('title', $title, [ ]);
182 182
         }
183 183
 
184 184
         return $html;
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
     /**
188 188
      * @inheritdoc
189 189
      */
190
-    public function renderAttributes($params = []): array
190
+    public function renderAttributes($params = [ ]): array
191 191
     {
192
-        $attributes = [];
192
+        $attributes = [ ];
193 193
         $title = $this->title;
194 194
         if ($this->prepForRender($title)) {
195
-            $attributes = ['title' => $title];
195
+            $attributes = [ 'title' => $title ];
196 196
         }
197 197
 
198 198
         return $attributes;
Please login to merge, or discard this patch.
src/models/MetaTag.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @return MetaTag
48 48
      */
49
-    public static function create($tagType = null, array $config = []): MetaTag
49
+    public static function create($tagType = null, array $config = [ ]): MetaTag
50 50
     {
51 51
         $tagType = Inflector::variablize($tagType);
52 52
         // Variablize the keys so that they coincide with our property names
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $rules = parent::rules();
120 120
         $rules = array_merge($rules, [
121
-            [['charset', 'httpEquiv', 'name', 'property'], 'string'],
122
-            [['content'], 'validateStringOrArray'],
123
-            [['name'], 'safe', 'on' => ['warning']]
121
+            [ [ 'charset', 'httpEquiv', 'name', 'property' ], 'string' ],
122
+            [ [ 'content' ], 'validateStringOrArray' ],
123
+            [ [ 'name' ], 'safe', 'on' => [ 'warning' ] ]
124 124
         ]);
125 125
 
126 126
         return $rules;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                 $error = Craft::t(
156 156
                     'seomatic',
157 157
                     '{tagtype} tag `{key}` did not render because it is missing attributes. ' . print_r($data, true),
158
-                    ['tagtype' => 'Meta', 'key' => $this->key]
158
+                    [ 'tagtype' => 'Meta', 'key' => $this->key ]
159 159
                 );
160 160
                 Craft::error($error, __METHOD__);
161 161
                 $shouldRender = false;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     /**
169 169
      * @inheritdoc
170 170
      */
171
-    public function render($params = []): string
171
+    public function render($params = [ ]): string
172 172
     {
173 173
         $html = '';
174 174
         $configs = $this->tagAttributesArray();
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
     /**
186 186
      * @inheritdoc
187 187
      */
188
-    public function renderAttributes($params = []): array
188
+    public function renderAttributes($params = [ ]): array
189 189
     {
190
-        $attributes = [];
190
+        $attributes = [ ];
191 191
 
192 192
         $configs = $this->tagAttributesArray();
193 193
         foreach ($configs as $config) {
Please login to merge, or discard this patch.
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/MetaBundleSettings.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return null|MetaBundleSettings
37 37
      */
38
-    public static function create(array $config = [])
38
+    public static function create(array $config = [ ])
39 39
     {
40 40
         $model = new MetaBundleSettings($config);
41 41
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     /**
79 79
      * @var int[] The AssetIDs for the SEO Image
80 80
      */
81
-    public $seoImageIds = [];
81
+    public $seoImageIds = [ ];
82 82
 
83 83
     /**
84 84
      * @var string The source that the SEO image should come from
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     /**
144 144
      * @var int[] The AssetIDs for the Twitter Image
145 145
      */
146
-    public $twitterImageIds = [];
146
+    public $twitterImageIds = [ ];
147 147
 
148 148
     /**
149 149
      * @var string The source that the Twitter image should come from
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     /**
199 199
      * @var int[] The AssetIDs for the Facebook OG Image
200 200
      */
201
-    public $ogImageIds = [];
201
+    public $ogImageIds = [ ];
202 202
 
203 203
     /**
204 204
      * @var string The source that the OpenGraph image should come from
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                 'boolean'
289 289
             ],
290 290
             [
291
-                ['seoImageSource', 'twitterImageSource', 'ogImageSource'], 'in', 'range' => [
291
+                [ 'seoImageSource', 'twitterImageSource', 'ogImageSource' ], 'in', 'range' => [
292 292
                     'sameAsSeo',
293 293
                     'fromField',
294 294
                     'fromAsset',
@@ -296,27 +296,27 @@  discard block
 block discarded – undo
296 296
                 ],
297 297
             ],
298 298
             [
299
-                ['seoTitleSource', 'twitterTitleSource', 'ogTitleSource'], 'in', 'range' => [
299
+                [ 'seoTitleSource', 'twitterTitleSource', 'ogTitleSource' ], 'in', 'range' => [
300 300
                     'sameAsSeo',
301 301
                     'fromField',
302 302
                     'fromCustom',
303 303
                 ],
304 304
             ],
305 305
             [
306
-                ['twitterCreatorSource'], 'in', 'range' => [
306
+                [ 'twitterCreatorSource' ], 'in', 'range' => [
307 307
                 'sameAsSiteTwitter',
308 308
                 'fromUserField',
309 309
                 'fromCustom',
310 310
                 ],
311 311
             ],
312 312
             [
313
-                ['twitterSiteNamePositionSource', 'ogSiteNamePositionSource'], 'in', 'range' => [
313
+                [ 'twitterSiteNamePositionSource', 'ogSiteNamePositionSource' ], 'in', 'range' => [
314 314
                 'sameAsSeo',
315 315
                 'fromCustom',
316 316
                 ],
317 317
             ],
318 318
             [
319
-                ['seoDescriptionSource', 'twitterDescriptionSource', 'ogDescriptionSource'], 'in', 'range' => [
319
+                [ 'seoDescriptionSource', 'twitterDescriptionSource', 'ogDescriptionSource' ], 'in', 'range' => [
320 320
                     'sameAsSeo',
321 321
                     'fromField',
322 322
                     'summaryFromField',
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
                 ],
325 325
             ],
326 326
             [
327
-                ['seoKeywordsSource'], 'in', 'range' => [
327
+                [ 'seoKeywordsSource' ], 'in', 'range' => [
328 328
                     'sameAsSeo',
329 329
                     'fromField',
330 330
                     'keywordsFromField',
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                 ],
333 333
             ],
334 334
             [
335
-                ['seoImageDescriptionSource', 'twitterImageDescriptionSource', 'ogImageDescriptionSource'], 'in', 'range' => [
335
+                [ 'seoImageDescriptionSource', 'twitterImageDescriptionSource', 'ogImageDescriptionSource' ], 'in', 'range' => [
336 336
                     'sameAsSeo',
337 337
                     'fromField',
338 338
                     'summaryFromField',
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
                     'twitterImageIds',
346 346
                     'ogImageIds',
347 347
                 ],
348
-                'each', 'rule' => ['integer'],
348
+                'each', 'rule' => [ 'integer' ],
349 349
             ],
350 350
         ];
351 351
     }
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.