@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | * @param array $included The included translations data |
107 | 107 | * @return string|null |
108 | 108 | */ |
109 | - public function field(array $object, string $attribute, ?string $lang = null, bool $defaultNull = false, array $included = []) : ?string |
|
109 | + public function field(array $object, string $attribute, ?string $lang = null, bool $defaultNull = false, array $included = [ ]) : ?string |
|
110 | 110 | { |
111 | 111 | $defaultValue = null; |
112 | 112 | if (!$defaultNull) { |
113 | 113 | $defaultValue = Hash::get($object, sprintf('attributes.%s', $attribute), Hash::get($object, sprintf('%s', $attribute))); |
114 | 114 | } |
115 | - if (empty($included) && !empty($this->getView()->viewVars['included'])) { |
|
116 | - $included = $this->getView()->viewVars['included']; |
|
115 | + if (empty($included) && !empty($this->getView()->viewVars[ 'included' ])) { |
|
116 | + $included = $this->getView()->viewVars[ 'included' ]; |
|
117 | 117 | } |
118 | 118 | if (empty($lang)) { |
119 | 119 | $lang = Configure::read('I18n.lang', ''); |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | * @param array $included The included translations data) |
136 | 136 | * @return bool |
137 | 137 | */ |
138 | - public function exists(array $object, string $attribute, ?string $lang = null, array &$included = []) : bool |
|
138 | + public function exists(array $object, string $attribute, ?string $lang = null, array &$included = [ ]) : bool |
|
139 | 139 | { |
140 | - if (empty($included) && !empty($this->getView()->viewVars['included'])) { |
|
141 | - $included = $this->getView()->viewVars['included']; |
|
140 | + if (empty($included) && !empty($this->getView()->viewVars[ 'included' ])) { |
|
141 | + $included = $this->getView()->viewVars[ 'included' ]; |
|
142 | 142 | } |
143 | 143 | if (empty($lang)) { |
144 | 144 | $lang = Configure::read('I18n.lang', ''); |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | */ |
177 | 177 | private function getTranslatedField(array $object, string $attribute, string $lang, array &$included) : ?string |
178 | 178 | { |
179 | - if (empty($object['id'])) { |
|
179 | + if (empty($object[ 'id' ])) { |
|
180 | 180 | return null; |
181 | 181 | } |
182 | 182 | |
183 | - $id = $object['id']; |
|
183 | + $id = $object[ 'id' ]; |
|
184 | 184 | |
185 | 185 | if ($this->translation === null) { |
186 | 186 | $translations = Hash::combine($included, '{n}.id', '{n}.attributes', '{n}.type'); |