diff --git a/src/Support/Format.php b/src/Support/Format.php index b3b1f18..3af61ec 100644 --- a/src/Support/Format.php +++ b/src/Support/Format.php @@ -152,15 +152,12 @@ protected function formatMessage(int $code, ?string $message): ?string protected function formatStatus(int $code): string { $statusCode = $this->formatStatusCode($code); - if ($statusCode >= 400 && $statusCode <= 499) {// client error - $status = 'error'; - } elseif ($statusCode >= 500 && $statusCode <= 599) {// service error - $status = 'fail'; - } else { - $status = 'success'; - } - return $status; + return match(true) { + ($statusCode >= 400 && $statusCode <= 499) => 'error',// client error + ($statusCode >= 500 && $statusCode <= 599) => 'fail',// service error + default => 'success' + }; } /**