|
@@ -42,9 +42,9 @@ discard block |
|
|
block discarded – undo |
|
42
|
42
|
|
|
43
|
43
|
if ($ex instanceof HttpException) { |
|
44
|
44
|
// Check if we have any exception configuration for this particular Http status code. |
|
45
|
|
- $ex_cfg = $cfg[ HttpException::class ][ $ex->getStatusCode() ] ?? null; |
|
|
45
|
+ $ex_cfg = $cfg[HttpException::class][$ex->getStatusCode()] ?? null; |
|
46
|
46
|
if ($ex_cfg === null) { |
|
47
|
|
- $ex_cfg = $cfg[ HttpException::class ]['default']; |
|
|
47
|
+ $ex_cfg = $cfg[HttpException::class]['default']; |
|
48
|
48
|
} |
|
49
|
49
|
|
|
50
|
50
|
$api_code = $ex_cfg['api_code'] ?? BaseApiCodes::EX_UNCAUGHT_EXCEPTION(); |
|
@@ -53,7 +53,7 @@ discard block |
|
|
block discarded – undo |
|
53
|
53
|
$result = static::error($ex, $api_code, $http_code, $msg_key); |
|
54
|
54
|
} elseif ($ex instanceof ValidationException) { |
|
55
|
55
|
$http_code = HttpResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
56
|
|
- $ex_cfg = $cfg[ HttpException::class ][ $http_code ]; |
|
|
56
|
+ $ex_cfg = $cfg[HttpException::class][$http_code]; |
|
57
|
57
|
$api_code = $ex_cfg['api_code'] ?? BaseApiCodes::EX_UNCAUGHT_EXCEPTION(); |
|
58
|
58
|
$http_code = $ex_cfg['http_code'] ?? $http_code; |
|
59
|
59
|
$result = static::error($ex, $api_code, $http_code); |
|
@@ -79,8 +79,8 @@ discard block |
|
|
block discarded – undo |
|
79
|
79
|
AuthException $exception): HttpResponse |
|
80
|
80
|
{ |
|
81
|
81
|
$cfg = static::getExceptionHandlerConfig(HttpException::class); |
|
82
|
|
- $api_code = $cfg[ HttpResponse::HTTP_UNAUTHORIZED ]['api_code']; |
|
83
|
|
- $http_code = $cfg[ HttpResponse::HTTP_UNAUTHORIZED ]['http_code']; |
|
|
82
|
+ $api_code = $cfg[HttpResponse::HTTP_UNAUTHORIZED]['api_code']; |
|
|
83
|
+ $http_code = $cfg[HttpResponse::HTTP_UNAUTHORIZED]['http_code']; |
|
84
|
84
|
|
|
85
|
85
|
return static::error($exception, $api_code, $http_code); |
|
86
|
86
|
} |
|
@@ -201,6 +201,6 @@ discard block |
|
|
block discarded – undo |
|
201
|
201
|
$result = array_merge(Config::get(ResponseBuilder::CONF_EXCEPTION_HANDLER_KEY, []), |
|
202
|
202
|
self::getExceptionHandlerBaseConfig()); |
|
203
|
203
|
|
|
204
|
|
- return ($key === null) ? $result : $result[ $key ]; |
|
|
204
|
+ return ($key === null) ? $result : $result[$key]; |
|
205
|
205
|
} |
|
206
|
206
|
} |