@@ -38,7 +38,7 @@ discard block |
||
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 |
||
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 | } |
@@ -71,35 +71,35 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -37,7 +37,7 @@ discard block |
||
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 |
||
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 | // ========================================================================= |
@@ -45,7 +45,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -38,7 +38,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -28,7 +28,7 @@ discard block |
||
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 |
||
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 | } |
@@ -37,7 +37,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $rules = parent::rules(); |
54 | 54 | $rules = array_merge($rules, [ |
55 | 55 | // Description tags have a special length |
56 | - [['content'], 'string', 'length' => [70, 200], 'on' => ['warning']], |
|
56 | + [ [ 'content' ], 'string', 'length' => [ 70, 200 ], 'on' => [ 'warning' ] ], |
|
57 | 57 | ]); |
58 | 58 | |
59 | 59 | return $rules; |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | { |
67 | 67 | $shouldRender = parent::prepForRender($data); |
68 | 68 | if ($shouldRender) { |
69 | - if (!empty($data['content'])) { |
|
69 | + if (!empty($data[ 'content' ])) { |
|
70 | 70 | // Truncate the Description tag content |
71 | - $data['content'] = (string)Stringy::create($data['content'])->safeTruncate( |
|
71 | + $data[ 'content' ] = (string)Stringy::create($data[ 'content' ])->safeTruncate( |
|
72 | 72 | 200, |
73 | 73 | '…' |
74 | 74 | ); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $rules = parent::rules(); |
54 | 54 | $rules = array_merge($rules, [ |
55 | 55 | // Description tags have a special length |
56 | - [['content'], 'string', 'length' => [70, Seomatic::$settings->maxDescriptionLength], 'on' => ['warning']], |
|
56 | + [ [ 'content' ], 'string', 'length' => [ 70, Seomatic::$settings->maxDescriptionLength ], 'on' => [ 'warning' ] ], |
|
57 | 57 | ]); |
58 | 58 | |
59 | 59 | return $rules; |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | { |
67 | 67 | $shouldRender = parent::prepForRender($data); |
68 | 68 | if ($shouldRender) { |
69 | - if (!empty($data['content'])) { |
|
69 | + if (!empty($data[ 'content' ])) { |
|
70 | 70 | // Truncate the Description tag content |
71 | - $data['content'] = (string)Stringy::create($data['content'])->safeTruncate( |
|
71 | + $data[ 'content' ] = (string)Stringy::create($data[ 'content' ])->safeTruncate( |
|
72 | 72 | Seomatic::$settings->maxDescriptionLength, |
73 | 73 | '…' |
74 | 74 | ); |