@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * {@inheritDoc} |
| 33 | 33 | */ |
| 34 | - public $helpers = ['Html']; |
|
| 34 | + public $helpers = [ 'Html' ]; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Translation data per object and lang (internal cache). |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | * @param array $included The included translations data |
| 159 | 159 | * @return string|null |
| 160 | 160 | */ |
| 161 | - public function field(array $object, string $attribute, ?string $lang = null, bool $defaultNull = false, array $included = []) : ?string |
|
| 161 | + public function field(array $object, string $attribute, ?string $lang = null, bool $defaultNull = false, array $included = [ ]) : ?string |
|
| 162 | 162 | { |
| 163 | 163 | $defaultValue = null; |
| 164 | 164 | if (!$defaultNull) { |
| 165 | 165 | $defaultValue = Hash::get($object, sprintf('attributes.%s', $attribute), Hash::get($object, sprintf('%s', $attribute))); |
| 166 | 166 | } |
| 167 | - if (empty($included) && !empty($this->getView()->viewVars['included'])) { |
|
| 168 | - $included = $this->getView()->viewVars['included']; |
|
| 167 | + if (empty($included) && !empty($this->getView()->viewVars[ 'included' ])) { |
|
| 168 | + $included = $this->getView()->viewVars[ 'included' ]; |
|
| 169 | 169 | } |
| 170 | 170 | if (empty($lang)) { |
| 171 | 171 | $lang = Configure::read('I18n.lang', ''); |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | * @param array $included The included translations data) |
| 188 | 188 | * @return bool |
| 189 | 189 | */ |
| 190 | - public function exists(array $object, string $attribute, ?string $lang = null, array &$included = []) : bool |
|
| 190 | + public function exists(array $object, string $attribute, ?string $lang = null, array &$included = [ ]) : bool |
|
| 191 | 191 | { |
| 192 | - if (empty($included) && !empty($this->getView()->viewVars['included'])) { |
|
| 193 | - $included = $this->getView()->viewVars['included']; |
|
| 192 | + if (empty($included) && !empty($this->getView()->viewVars[ 'included' ])) { |
|
| 193 | + $included = $this->getView()->viewVars[ 'included' ]; |
|
| 194 | 194 | } |
| 195 | 195 | if (empty($lang)) { |
| 196 | 196 | $lang = Configure::read('I18n.lang', ''); |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | private function getTranslatedField(array $object, string $attribute, string $lang, array &$included) : ?string |
| 230 | 230 | { |
| 231 | - if (empty($object['id'])) { |
|
| 231 | + if (empty($object[ 'id' ])) { |
|
| 232 | 232 | return null; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $id = $object['id']; |
|
| 235 | + $id = $object[ 'id' ]; |
|
| 236 | 236 | |
| 237 | 237 | if ($this->translation === null) { |
| 238 | 238 | $translations = Hash::combine($included, '{n}.id', '{n}.attributes', '{n}.type'); |