Passed
Push — v3 ( 21dc87...5a2177 )
by Andrew
13:57 queued 07:33
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/SitemapTemplate.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return null|SitemapTemplate
65 65
      */
66
-    public static function create(array $config = [])
66
+    public static function create(array $config = [ ])
67 67
     {
68 68
         $defaults = [
69 69
             'path'       => 'sitemaps/<groupId:\d+>/<type:[-\w\.*]+>/<handle:[-\w\.*]+>/<siteId:\d+>/<file:[-\w\.*]+>',
@@ -110,32 +110,32 @@  discard block
 block discarded – undo
110 110
     /**
111 111
      * @inheritdoc
112 112
      */
113
-    public function render($params = []): string
113
+    public function render($params = [ ]): string
114 114
     {
115 115
         $cache = Craft::$app->getCache();
116
-        $groupId = $params['groupId'];
116
+        $groupId = $params[ 'groupId' ];
117 117
         /** @var SiteGroup $siteGroup */
118 118
         $siteGroup = Craft::$app->getSites()->getGroupById($groupId);
119 119
         $groupSiteIds = $siteGroup->getSiteIds();
120
-        $type = $params['type'];
121
-        $handle = $params['handle'];
122
-        $siteId = $params['siteId'];
120
+        $type = $params[ 'type' ];
121
+        $handle = $params[ 'handle' ];
122
+        $siteId = $params[ 'siteId' ];
123 123
         $duration = Seomatic::$devMode ? $this::DEVMODE_SITEMAP_CACHE_DURATION : $this::SITEMAP_CACHE_DURATION;
124 124
         $dependency = new TagDependency([
125 125
             'tags' => [
126 126
                 $this::GLOBAL_SITEMAP_CACHE_TAG,
127
-                $this::SITEMAP_CACHE_TAG.$handle.$siteId,
127
+                $this::SITEMAP_CACHE_TAG . $handle . $siteId,
128 128
             ],
129 129
         ]);
130 130
 
131
-        return $cache->getOrSet($this::CACHE_KEY.$groupId.$handle.$siteId, function () use ($type, $handle, $siteId, $groupSiteIds) {
131
+        return $cache->getOrSet($this::CACHE_KEY . $groupId . $handle . $siteId, function() use ($type, $handle, $siteId, $groupSiteIds) {
132 132
             Craft::info(
133
-                'Sitemap cache miss: '.$handle.'/'.$siteId,
133
+                'Sitemap cache miss: ' . $handle . '/' . $siteId,
134 134
                 __METHOD__
135 135
             );
136
-            $lines = [];
136
+            $lines = [ ];
137 137
             // Sitemap index XML header and opening tag
138
-            $lines[] = '<?xml version="1.0" encoding="UTF-8"?>';
138
+            $lines[ ] = '<?xml version="1.0" encoding="UTF-8"?>';
139 139
             // One sitemap entry for each element
140 140
             $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle($type, $handle, $siteId);
141 141
             $multiSite = count($metaBundle->sourceAltSiteSettings) > 1;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                     $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"';
151 151
                 }
152 152
                 $urlsetLine .= '>';
153
-                $lines[] = $urlsetLine;
153
+                $lines[ ] = $urlsetLine;
154 154
                 // Handle each element type separately
155 155
                 switch ($metaBundle->sourceBundleType) {
156 156
                     case MetaBundles::SECTION_META_BUNDLE:
@@ -176,25 +176,25 @@  discard block
 block discarded – undo
176 176
                     $path = ($element->uri === '__home__') ? '' : $element->uri;
177 177
                     $url = UrlHelper::siteUrl($path, null, null, $metaBundle->sourceSiteId);
178 178
                     $dateUpdated = $element->dateUpdated ?? $element->dateCreated ?? new \DateTime;
179
-                    $lines[] = '  <url>';
179
+                    $lines[ ] = '  <url>';
180 180
                     // Standard sitemap key/values
181
-                    $lines[] = '    <loc>';
182
-                    $lines[] = '      '.$url;
183
-                    $lines[] = '    </loc>';
184
-                    $lines[] = '    <lastmod>';
185
-                    $lines[] = '      '.$dateUpdated->format(\DateTime::W3C);
186
-                    $lines[] = '    </lastmod>';
187
-                    $lines[] = '    <changefreq>';
188
-                    $lines[] = '      '.$metaBundle->metaSitemapVars->sitemapChangeFreq;
189
-                    $lines[] = '    </changefreq>';
190
-                    $lines[] = '    <priority>';
191
-                    $lines[] = '      '.$metaBundle->metaSitemapVars->sitemapPriority;
192
-                    $lines[] = '    </priority>';
181
+                    $lines[ ] = '    <loc>';
182
+                    $lines[ ] = '      ' . $url;
183
+                    $lines[ ] = '    </loc>';
184
+                    $lines[ ] = '    <lastmod>';
185
+                    $lines[ ] = '      ' . $dateUpdated->format(\DateTime::W3C);
186
+                    $lines[ ] = '    </lastmod>';
187
+                    $lines[ ] = '    <changefreq>';
188
+                    $lines[ ] = '      ' . $metaBundle->metaSitemapVars->sitemapChangeFreq;
189
+                    $lines[ ] = '    </changefreq>';
190
+                    $lines[ ] = '    <priority>';
191
+                    $lines[ ] = '      ' . $metaBundle->metaSitemapVars->sitemapPriority;
192
+                    $lines[ ] = '    </priority>';
193 193
                     // Handle alternate URLs if this is multi-site
194 194
                     if ($multiSite && $metaBundle->metaSitemapVars->sitemapAltLinks) {
195 195
                         /** @var  $altSiteSettings */
196 196
                         foreach ($metaBundle->sourceAltSiteSettings as $altSiteSettings) {
197
-                            if (in_array($altSiteSettings['siteId'], $groupSiteIds)) {
197
+                            if (in_array($altSiteSettings[ 'siteId' ], $groupSiteIds)) {
198 198
                                 $altElement = null;
199 199
                                 // Handle each element type separately
200 200
                                 switch ($metaBundle->sourceBundleType) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                                         $altElement = Entry::find()
203 203
                                             ->section($metaBundle->sourceHandle)
204 204
                                             ->id($element->id)
205
-                                            ->siteId($altSiteSettings['siteId'])
205
+                                            ->siteId($altSiteSettings[ 'siteId' ])
206 206
                                             ->enabledForSite(true)
207 207
                                             ->limit(1)
208 208
                                             ->one();
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                                     case MetaBundles::CATEGORYGROUP_META_BUNDLE:
212 212
                                         $altElement = Category::find()
213 213
                                             ->id($element->id)
214
-                                            ->siteId($altSiteSettings['siteId'])
214
+                                            ->siteId($altSiteSettings[ 'siteId' ])
215 215
                                             ->limit(1)
216 216
                                             ->enabledForSite(true)
217 217
                                             ->one();
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
                                     // @todo: handle Commerce products
220 220
                                 }
221 221
                                 if ($altElement) {
222
-                                    $lines[] = '    <xhtml:link rel="alternate"'
223
-                                        .' hreflang="'.$altSiteSettings['language'].'"'
224
-                                        .' href="'.$altElement->url.'"'
222
+                                    $lines[ ] = '    <xhtml:link rel="alternate"'
223
+                                        .' hreflang="' . $altSiteSettings[ 'language' ] . '"'
224
+                                        .' href="' . $altElement->url . '"'
225 225
                                         .' />';
226 226
                                 }
227 227
                             }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                             true
237 237
                         );
238 238
                         foreach ($assetFields as $assetField) {
239
-                            $assets = $element[$assetField]->all();
239
+                            $assets = $element[ $assetField ]->all();
240 240
                             foreach ($assets as $asset) {
241 241
                                 $this->assetSitemapItem($asset, $metaBundle, $lines);
242 242
                             }
@@ -248,19 +248,19 @@  discard block
 block discarded – undo
248 248
                             true
249 249
                         );
250 250
                         foreach ($matrixFields as $matrixField) {
251
-                            $matrixBlocks = $element[$matrixField]->all();
251
+                            $matrixBlocks = $element[ $matrixField ]->all();
252 252
                             foreach ($matrixBlocks as $matrixBlock) {
253 253
                                 $assetFields = FieldHelper::matrixFieldsOfType($matrixBlock, AssetsField::class);
254 254
                                 foreach ($assetFields as $assetField) {
255 255
                                     /** @var MatrixBlock $matrixBlock */
256
-                                    foreach ($matrixBlock[$assetField]->all() as $asset) {
256
+                                    foreach ($matrixBlock[ $assetField ]->all() as $asset) {
257 257
                                         $this->assetSitemapItem($asset, $metaBundle, $lines);
258 258
                                     }
259 259
                                 }
260 260
                             }
261 261
                         }
262 262
                     }
263
-                    $lines[] = '  </url>';
263
+                    $lines[ ] = '  </url>';
264 264
                     // Include links to any known file types in the assets fields
265 265
                     if ($metaBundle->metaSitemapVars->sitemapFiles) {
266 266
                         // Regular Assets fields
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                             true
271 271
                         );
272 272
                         foreach ($assetFields as $assetField) {
273
-                            $assets = $element[$assetField]->all();
273
+                            $assets = $element[ $assetField ]->all();
274 274
                             foreach ($assets as $asset) {
275 275
                                 $this->assetFilesSitemapLink($asset, $metaBundle, $lines);
276 276
                             }
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
                             true
283 283
                         );
284 284
                         foreach ($matrixFields as $matrixField) {
285
-                            $matrixBlocks = $element[$matrixField]->all();
285
+                            $matrixBlocks = $element[ $matrixField ]->all();
286 286
                             /** @var MatrixBlock $matrixBlock */
287 287
                             foreach ($matrixBlocks as $matrixBlock) {
288 288
                                 $assetFields = FieldHelper::matrixFieldsOfType($matrixBlock, AssetsField::class);
289 289
                                 foreach ($assetFields as $assetField) {
290
-                                    foreach ($matrixBlock[$assetField]->all() as $asset) {
290
+                                    foreach ($matrixBlock[ $assetField ]->all() as $asset) {
291 291
                                         $this->assetFilesSitemapLink($asset, $metaBundle, $lines);
292 292
                                     }
293 293
                                 }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
                     }
297 297
                 }
298 298
                 // Sitemap index closing tag
299
-                $lines[] = '</urlset>';
299
+                $lines[ ] = '</urlset>';
300 300
             }
301 301
 
302 302
             return implode("\r\n", $lines);
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
     public function invalidateCache(string $handle, int $siteId)
313 313
     {
314 314
         $cache = Craft::$app->getCache();
315
-        TagDependency::invalidate($cache, $this::SITEMAP_CACHE_TAG.$handle.$siteId);
315
+        TagDependency::invalidate($cache, $this::SITEMAP_CACHE_TAG . $handle . $siteId);
316 316
         Craft::info(
317
-            'Sitemap cache cleared: '.$handle,
317
+            'Sitemap cache cleared: ' . $handle,
318 318
             __METHOD__
319 319
         );
320 320
     }
@@ -329,42 +329,42 @@  discard block
 block discarded – undo
329 329
         if ($asset->enabledForSite) {
330 330
             switch ($asset->kind) {
331 331
                 case 'image':
332
-                    $lines[] = '    <image:image>';
333
-                    $lines[] = '      <image:loc>';
334
-                    $lines[] = '        '.$asset->getUrl();
335
-                    $lines[] = '      </image:loc>';
332
+                    $lines[ ] = '    <image:image>';
333
+                    $lines[ ] = '      <image:loc>';
334
+                    $lines[ ] = '        ' . $asset->getUrl();
335
+                    $lines[ ] = '      </image:loc>';
336 336
                     // Handle the dynamic field => property mappings
337 337
                     foreach ($metaBundle->metaSitemapVars->sitemapImageFieldMap as $row) {
338
-                        $fieldName = $row['field'] ?? '';
339
-                        $propName = $row['property'] ?? '';
340
-                        if (!empty($asset[$fieldName]) && !empty($propName)) {
341
-                            $lines[] = '      <image:'.$propName.'>';
342
-                            $lines[] = '        '.$asset[$fieldName];
343
-                            $lines[] = '      </image:'.$propName.'>';
338
+                        $fieldName = $row[ 'field' ] ?? '';
339
+                        $propName = $row[ 'property' ] ?? '';
340
+                        if (!empty($asset[ $fieldName ]) && !empty($propName)) {
341
+                            $lines[ ] = '      <image:' . $propName . '>';
342
+                            $lines[ ] = '        ' . $asset[ $fieldName ];
343
+                            $lines[ ] = '      </image:' . $propName . '>';
344 344
                         }
345 345
                     }
346
-                    $lines[] = '    </image:image>';
346
+                    $lines[ ] = '    </image:image>';
347 347
                     break;
348 348
 
349 349
                 case 'video':
350
-                    $lines[] = '    <video:video>';
351
-                    $lines[] = '      <video:content_loc>';
352
-                    $lines[] = '        '.$asset->getUrl();
353
-                    $lines[] = '      </video:content_loc>';
354
-                    $lines[] = '      <video:thumbnail_loc>';
355
-                    $lines[] = '        '.$asset->getThumbUrl(320);
356
-                    $lines[] = '      </video:thumbnail_loc>';
350
+                    $lines[ ] = '    <video:video>';
351
+                    $lines[ ] = '      <video:content_loc>';
352
+                    $lines[ ] = '        ' . $asset->getUrl();
353
+                    $lines[ ] = '      </video:content_loc>';
354
+                    $lines[ ] = '      <video:thumbnail_loc>';
355
+                    $lines[ ] = '        ' . $asset->getThumbUrl(320);
356
+                    $lines[ ] = '      </video:thumbnail_loc>';
357 357
                     // Handle the dynamic field => property mappings
358 358
                     foreach ($metaBundle->metaSitemapVars->sitemapVideoFieldMap as $row) {
359
-                        $fieldName = $row['field'] ?? '';
360
-                        $propName = $row['property'] ?? '';
361
-                        if (!empty($asset[$fieldName]) && !empty($propName)) {
362
-                            $lines[] = '      <video:'.$propName.'>';
363
-                            $lines[] = '        '.$asset[$fieldName];
364
-                            $lines[] = '      </video:'.$propName.'>';
359
+                        $fieldName = $row[ 'field' ] ?? '';
360
+                        $propName = $row[ 'property' ] ?? '';
361
+                        if (!empty($asset[ $fieldName ]) && !empty($propName)) {
362
+                            $lines[ ] = '      <video:' . $propName . '>';
363
+                            $lines[ ] = '        ' . $asset[ $fieldName ];
364
+                            $lines[ ] = '      </video:' . $propName . '>';
365 365
                         }
366 366
                     }
367
-                    $lines[] = '    </video:video>';
367
+                    $lines[ ] = '    </video:video>';
368 368
                     break;
369 369
             }
370 370
         }
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
         if ($asset->enabledForSite) {
381 381
             if (in_array($asset->kind, $this::FILE_TYPES)) {
382 382
                 $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new \DateTime;
383
-                $lines[] = '  <url>';
384
-                $lines[] = '    <loc>';
385
-                $lines[] = '      '.$asset->getUrl();
386
-                $lines[] = '    </loc>';
387
-                $lines[] = '    <lastmod>';
388
-                $lines[] = '      '.$dateUpdated->format(\DateTime::W3C);
389
-                $lines[] = '    </lastmod>';
390
-                $lines[] = '    <changefreq>';
391
-                $lines[] = '      '.$metaBundle->metaSitemapVars->sitemapChangeFreq;
392
-                $lines[] = '    </changefreq>';
393
-                $lines[] = '    <priority>';
394
-                $lines[] = '      '.$metaBundle->metaSitemapVars->sitemapPriority;
395
-                $lines[] = '    </priority>';
396
-                $lines[] = '  </url>';
383
+                $lines[ ] = '  <url>';
384
+                $lines[ ] = '    <loc>';
385
+                $lines[ ] = '      ' . $asset->getUrl();
386
+                $lines[ ] = '    </loc>';
387
+                $lines[ ] = '    <lastmod>';
388
+                $lines[ ] = '      ' . $dateUpdated->format(\DateTime::W3C);
389
+                $lines[ ] = '    </lastmod>';
390
+                $lines[ ] = '    <changefreq>';
391
+                $lines[ ] = '      ' . $metaBundle->metaSitemapVars->sitemapChangeFreq;
392
+                $lines[ ] = '    </changefreq>';
393
+                $lines[ ] = '    <priority>';
394
+                $lines[ ] = '      ' . $metaBundle->metaSitemapVars->sitemapPriority;
395
+                $lines[ ] = '    </priority>';
396
+                $lines[ ] = '  </url>';
397 397
             }
398 398
         }
399 399
     }
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.