Skip to content

Commit

Permalink
Change it to getStatusCodeReason instead
Browse files Browse the repository at this point in the history
  • Loading branch information
vermakhushboo committed Feb 1, 2024
1 parent f2ac1ee commit 4496dcd
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/Swoole/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ class Response extends UtopiaResponse
*/
protected SwooleResponse $swoole;

/**
* Status Code Reason
*
* @var string
*/
protected string $reason = '';

/**
* HTTP response status codes
*/
Expand Down Expand Up @@ -195,15 +188,15 @@ protected function end(string $content = null): void
}

/**
* Set status code reason
* Get status code reason
*
* Set HTTP response status code reason between available options. If status code is unknown an exception will be thrown.
* Get HTTP response status code reason from available options. If status code is unknown an exception will be thrown.
*
* @param int $code
*
* @throws Exception
*/
protected function setStatusCodeReason(int $code): static
protected function getStatusCodeReason(int $code): static
{
if (!\array_key_exists($code, $this->statusCodes)) {
throw new Exception('Unknown HTTP status code');
Expand All @@ -222,8 +215,7 @@ protected function setStatusCodeReason(int $code): static
*/
protected function sendStatus(int $statusCode): void
{
$this->setStatusCodeReason($statusCode);
$this->swoole->status((string) $statusCode, $this->reason);
$this->swoole->status((string) $statusCode, $this->getStatusCodeReason($statusCode));
}

/**
Expand Down

0 comments on commit 4496dcd

Please sign in to comment.