diff --git a/src/Protocols/Http.php b/src/Protocols/Http.php index ef7355964..c528ee08b 100644 --- a/src/Protocols/Http.php +++ b/src/Protocols/Http.php @@ -248,7 +248,7 @@ public static function encode(mixed $response, TcpConnection $connection): strin } $handler = fopen($file, 'r'); if (false === $handler) { - $connection->close(new Response(403, null, '403 Forbidden')); + $connection->close(new Response(403, [], '403 Forbidden')); return ''; } $connection->send((string)$response, true); diff --git a/src/Protocols/Http/Response.php b/src/Protocols/Http/Response.php index 0dceca14f..0df251983 100644 --- a/src/Protocols/Http/Response.php +++ b/src/Protocols/Http/Response.php @@ -39,19 +39,6 @@ */ class Response implements Stringable { - /** - * Header data. - * - * @var array - */ - protected array $headers = []; - - /** - * Http status. - * - * @var int - */ - protected int $status; /** * Http reason. @@ -67,13 +54,6 @@ class Response implements Stringable */ protected string $version = '1.1'; - /** - * Http body. - * - * @var string - */ - protected string $body = ''; - /** * Send file info * @@ -177,20 +157,15 @@ public static function init(): void /** * Response constructor. * - * @param int $status - * @param array|null $headers + * @param int $status + * @param array $headers * @param string $body */ public function __construct( - int $status = 200, - ?array $headers = [], - string $body = '' - ) - { - $this->status = $status; - $this->headers = $headers; - $this->body = $body; - } + protected int $status = 200, + protected array $headers = [], + protected string $body = '' + ) {} /** * Set header.