Skip to content

Commit

Permalink
fix: optimize format status code logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jiannei committed Oct 30, 2024
1 parent cc2a2c3 commit f2e925d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Support/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function data(mixed $data = null, string $message = '', int|\BackedEnum $
'error' => $this->formatError($error),
]);

$this->statusCode = $this->formatStatusCode($bizCode, $error);
$this->statusCode = $this->formatStatusCode($bizCode);
});
}

Expand Down Expand Up @@ -165,9 +165,9 @@ protected function formatStatus(int $bizCode): string
/**
* Http status code.
*/
protected function formatStatusCode(int $code, $errors): int
protected function formatStatusCode(int $code): int
{
return (int) substr(is_null($errors) ? (Config::get('response.error_code') ?: $code) : $code, 0, 3);
return (int) substr(Config::get('response.error_code') ?: $code, 0, 3);
}

/**
Expand Down

0 comments on commit f2e925d

Please sign in to comment.