@@ -42,12 +42,12 @@ |
||
42 | 42 | $config = \array_replace($default_config, $user_config); |
43 | 43 | |
44 | 44 | $http_code = $ex->getStatusCode(); |
45 | - $result = $config[ $http_code ] ?? null; |
|
45 | + $result = $config[$http_code] ?? null; |
|
46 | 46 | |
47 | 47 | // If we do not have dedicated entry fort this particular http_code, |
48 | 48 | // fall back to default value. |
49 | 49 | if ($result === null) { |
50 | - $result = $config[ RB::KEY_DEFAULT ]; |
|
50 | + $result = $config[RB::KEY_DEFAULT]; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Some defaults to fall back to if not set in user config. |
@@ -375,7 +375,7 @@ |
||
375 | 375 | |
376 | 376 | if ($debug_data !== null) { |
377 | 377 | $debug_key = Config::get(RB::CONF_KEY_DEBUG_DEBUG_KEY, RB::KEY_DEBUG); |
378 | - $response[ $debug_key ] = $debug_data; |
|
378 | + $response[$debug_key] = $debug_data; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | return $response; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $result = null; |
62 | 62 | |
63 | 63 | $type = \gettype($data); |
64 | - $result = $this->primitives[ $type ] ?? null; |
|
64 | + $result = $this->primitives[$type] ?? null; |
|
65 | 65 | if ($result === null) { |
66 | 66 | throw new \InvalidArgumentException(sprintf('No data conversion mapping configured for "%s" primitive.', $type)); |
67 | 67 | } |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | $cls = \get_class($data); |
94 | 94 | if (\is_string($cls)) { |
95 | 95 | if (\array_key_exists($cls, $this->classes)) { |
96 | - $result = $this->classes[ $cls ]; |
|
96 | + $result = $this->classes[$cls]; |
|
97 | 97 | $debug_result = 'exact config match'; |
98 | 98 | } else { |
99 | 99 | // no exact match, then lets try with `instanceof` |
100 | 100 | foreach (\array_keys($this->classes) as $class_name) { |
101 | 101 | if ($data instanceof $class_name) { |
102 | - $result = $this->classes[ $class_name ]; |
|
102 | + $result = $this->classes[$class_name]; |
|
103 | 103 | $debug_result = "subclass of {$class_name}"; |
104 | 104 | break; |
105 | 105 | } |
@@ -146,22 +146,22 @@ discard block |
||
146 | 146 | |
147 | 147 | if ($result === null && \is_object($data)) { |
148 | 148 | $cfg = $this->getClassMappingConfigOrThrow($data); |
149 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
150 | - $result = [$cfg[ RB::KEY_KEY ] => $worker->convert($data, $cfg)]; |
|
149 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
150 | + $result = [$cfg[RB::KEY_KEY] => $worker->convert($data, $cfg)]; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | if ($result === null && \is_array($data)) { |
154 | 154 | $cfg = $this->getPrimitiveMappingConfigOrThrow($data); |
155 | 155 | |
156 | - if ($this->hasNonNumericKeys($data)){ |
|
156 | + if ($this->hasNonNumericKeys($data)) { |
|
157 | 157 | $result = $this->convertArray($data); |
158 | 158 | } else { |
159 | - $result = [$cfg[ RB::KEY_KEY ] => $this->convertArray($data)]; |
|
159 | + $result = [$cfg[RB::KEY_KEY] => $this->convertArray($data)]; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - if ( \is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
|
164 | - $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ RB::KEY_KEY ] => $data]; |
|
163 | + if (\is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
|
164 | + $result = [$this->getPrimitiveMappingConfigOrThrow($data)[RB::KEY_KEY] => $data]; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | return $result; |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | |
219 | 219 | foreach ($data as $key => $val) { |
220 | 220 | if (\is_array($val)) { |
221 | - $data[ $key ] = $this->convertArray($val); |
|
221 | + $data[$key] = $this->convertArray($val); |
|
222 | 222 | } elseif (\is_object($val)) { |
223 | 223 | $cfg = $this->getClassMappingConfigOrThrow($val); |
224 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
224 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
225 | 225 | $converted_data = $worker->convert($val, $cfg); |
226 | - $data[ $key ] = $converted_data; |
|
226 | + $data[$key] = $converted_data; |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | do { |
46 | 46 | if ($cfg === null) { |
47 | 47 | // Default handler MUST be present by design and always return something useful. |
48 | - $cfg = self::getExceptionHandlerConfig()[ RB::KEY_DEFAULT ]; |
|
48 | + $cfg = self::getExceptionHandlerConfig()[RB::KEY_DEFAULT]; |
|
49 | 49 | } |
50 | 50 | |
51 | - $handler = new $cfg[ RB::KEY_HANDLER ](); |
|
52 | - $handler_result = $handler->handle($cfg[ RB::KEY_CONFIG ], $ex); |
|
51 | + $handler = new $cfg[RB::KEY_HANDLER](); |
|
52 | + $handler_result = $handler->handle($cfg[RB::KEY_CONFIG], $ex); |
|
53 | 53 | if ($handler_result !== null) { |
54 | 54 | $result = self::processException($ex, $handler_result); |
55 | 55 | } else { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $cfg = self::getExceptionHandlerConfig(); |
148 | 148 | |
149 | 149 | // This config entry is guaranted to exist. Enforced by tests. |
150 | - $cfg = $cfg[ HttpException::class ][ RB::KEY_CONFIG ][ HttpResponse::HTTP_UNAUTHORIZED ]; |
|
150 | + $cfg = $cfg[HttpException::class][RB::KEY_CONFIG][HttpResponse::HTTP_UNAUTHORIZED]; |
|
151 | 151 | |
152 | 152 | return static::processException($exception, $cfg, HttpResponse::HTTP_UNAUTHORIZED); |
153 | 153 | } |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | |
278 | 278 | // check for exact class name match... |
279 | 279 | if (\array_key_exists($cls, $cfg)) { |
280 | - $result = $cfg[ $cls ]; |
|
280 | + $result = $cfg[$cls]; |
|
281 | 281 | } else { |
282 | 282 | // no exact match, then lets try with `instanceof` |
283 | 283 | // Config entries are already sorted by priority. |
284 | 284 | foreach (\array_keys($cfg) as $class_name) { |
285 | 285 | if ($ex instanceof $class_name) { |
286 | - $result = $cfg[ $class_name ]; |
|
286 | + $result = $cfg[$class_name]; |
|
287 | 287 | break; |
288 | 288 | } |
289 | 289 | } |