@@ -374,7 +374,7 @@ |
||
374 | 374 | |
375 | 375 | if ($debug_data !== null) { |
376 | 376 | $debug_key = Config::get(ResponseBuilder::CONF_KEY_DEBUG_DEBUG_KEY, ResponseBuilder::KEY_DEBUG); |
377 | - $response[ $debug_key ] = $debug_data; |
|
377 | + $response[$debug_key] = $debug_data; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | return $response; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $result = null; |
82 | 82 | |
83 | 83 | $type = \gettype($data); |
84 | - $result = $this->primitives[ $type ] ?? null; |
|
84 | + $result = $this->primitives[$type] ?? null; |
|
85 | 85 | if ($result === null) { |
86 | 86 | throw new \InvalidArgumentException(sprintf('No data conversion mapping configured for "%s" primitive.', $type)); |
87 | 87 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | $cls = \get_class($data); |
114 | 114 | if (\is_string($cls)) { |
115 | 115 | if (\array_key_exists($cls, $this->classes)) { |
116 | - $result = $this->classes[ $cls ]; |
|
116 | + $result = $this->classes[$cls]; |
|
117 | 117 | $debug_result = 'exact config match'; |
118 | 118 | } else { |
119 | 119 | // no exact match, then lets try with `instanceof` |
120 | 120 | foreach (\array_keys($this->getClasses()) as $class_name) { |
121 | 121 | if ($data instanceof $class_name) { |
122 | - $result = $this->classes[ $class_name ]; |
|
122 | + $result = $this->classes[$class_name]; |
|
123 | 123 | $debug_result = "subclass of {$class_name}"; |
124 | 124 | break; |
125 | 125 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | // check for exact class name match... |
159 | 159 | if (\array_key_exists($cls, $this->classes)) { |
160 | - $result = $this->classes[ $cls ]; |
|
160 | + $result = $this->classes[$cls]; |
|
161 | 161 | $debug_result = 'exact config match'; |
162 | 162 | } |
163 | 163 | |
@@ -200,22 +200,22 @@ discard block |
||
200 | 200 | |
201 | 201 | if ($result === null && \is_object($data)) { |
202 | 202 | $cfg = $this->getClassMappingConfigOrThrow($data); |
203 | - $worker = new $cfg[ ResponseBuilder::KEY_HANDLER ](); |
|
204 | - $result = [$cfg[ ResponseBuilder::KEY_KEY ] => $worker->convert($data, $cfg)]; |
|
203 | + $worker = new $cfg[ResponseBuilder::KEY_HANDLER](); |
|
204 | + $result = [$cfg[ResponseBuilder::KEY_KEY] => $worker->convert($data, $cfg)]; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | if ($result === null && \is_array($data)) { |
208 | 208 | $cfg = $this->getPrimitiveMappingConfigOrThrow($data); |
209 | 209 | |
210 | - if ($this->hasNonNumericKeys($data)){ |
|
210 | + if ($this->hasNonNumericKeys($data)) { |
|
211 | 211 | $result = $this->convertArray($data); |
212 | 212 | } else { |
213 | - $result = [$cfg[ ResponseBuilder::KEY_KEY ] => $this->convertArray($data)]; |
|
213 | + $result = [$cfg[ResponseBuilder::KEY_KEY] => $this->convertArray($data)]; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - if ( \is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
|
218 | - $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ ResponseBuilder::KEY_KEY ] => $data]; |
|
217 | + if (\is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
|
218 | + $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ResponseBuilder::KEY_KEY] => $data]; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | return $result; |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | |
266 | 266 | foreach ($data as $key => $val) { |
267 | 267 | if (\is_array($val)) { |
268 | - $data[ $key ] = $this->convertArray($val); |
|
268 | + $data[$key] = $this->convertArray($val); |
|
269 | 269 | } elseif (\is_object($val)) { |
270 | 270 | $cfg = $this->getClassMappingConfigOrThrow($val); |
271 | - $worker = new $cfg[ ResponseBuilder::KEY_HANDLER ](); |
|
271 | + $worker = new $cfg[ResponseBuilder::KEY_HANDLER](); |
|
272 | 272 | $converted_data = $worker->convert($val, $cfg); |
273 | - $data[ $key ] = $converted_data; |
|
273 | + $data[$key] = $converted_data; |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 |