@@ -42,17 +42,17 @@ |
||
| 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 ($result === null) { |
| 48 | - $result = $config[ ResponseBuilder::KEY_DEFAULT ]; |
|
| 48 | + $result = $config[ResponseBuilder::KEY_DEFAULT]; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (!\array_key_exists(ResponseBuilder::KEY_HTTP_CODE, $result)) { |
| 52 | - $result[ ResponseBuilder::KEY_HTTP_CODE ] = $http_code; |
|
| 52 | + $result[ResponseBuilder::KEY_HTTP_CODE] = $http_code; |
|
| 53 | 53 | } |
| 54 | 54 | if (\array_key_exists(ResponseBuilder::KEY_MSG_KEY, $result)) { |
| 55 | - $result[ ResponseBuilder::KEY_MSG_KEY ] = \sprintf('response-builder::builder.http_%d', $http_code); |
|
| 55 | + $result[ResponseBuilder::KEY_MSG_KEY] = \sprintf('response-builder::builder.http_%d', $http_code); |
|
| 56 | 56 | } |
| 57 | 57 | return $result; |
| 58 | 58 | } |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | do { |
| 45 | 45 | if ($cfg === null) { |
| 46 | 46 | // Default handler MUST be present by design and always return something useful. |
| 47 | - $cfg = self::getExceptionHandlerConfig()[ ResponseBuilder::KEY_DEFAULT ]; |
|
| 47 | + $cfg = self::getExceptionHandlerConfig()[ResponseBuilder::KEY_DEFAULT]; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $handler = new $cfg[ ResponseBuilder::KEY_HANDLER ](); |
|
| 51 | - $handler_result = $handler->handle($cfg[ ResponseBuilder::KEY_CONFIG ], $ex); |
|
| 50 | + $handler = new $cfg[ResponseBuilder::KEY_HANDLER](); |
|
| 51 | + $handler_result = $handler->handle($cfg[ResponseBuilder::KEY_CONFIG], $ex); |
|
| 52 | 52 | if ($handler_result !== null) { |
| 53 | 53 | $result = self::processException($ex, $handler_result); |
| 54 | 54 | } 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 ][ ResponseBuilder::KEY_CONFIG ][ HttpResponse::HTTP_UNAUTHORIZED ]; |
|
| 150 | + $cfg = $cfg[HttpException::class][ResponseBuilder::KEY_CONFIG][HttpResponse::HTTP_UNAUTHORIZED]; |
|
| 151 | 151 | |
| 152 | 152 | return static::processException($exception, $cfg, HttpResponse::HTTP_UNAUTHORIZED); |
| 153 | 153 | } |
@@ -280,13 +280,13 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | // check for exact class name match... |
| 282 | 282 | if (\array_key_exists($cls, $cfg)) { |
| 283 | - $result = $cfg[ $cls ]; |
|
| 283 | + $result = $cfg[$cls]; |
|
| 284 | 284 | } else { |
| 285 | 285 | // no exact match, then lets try with `instanceof` |
| 286 | 286 | // Config entries are already sorted by priority. |
| 287 | 287 | foreach (\array_keys($cfg) as $class_name) { |
| 288 | 288 | if ($ex instanceof $class_name) { |
| 289 | - $result = $cfg[ $class_name ]; |
|
| 289 | + $result = $cfg[$class_name]; |
|
| 290 | 290 | break; |
| 291 | 291 | } |
| 292 | 292 | } |