diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2024-01-31 06:11:00 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2024-01-31 20:45:40 +0300 |
commit | c0dc531ebefd8912819f3b6c8bda1fed3c7e750c (patch) | |
tree | 2c75aa9df182260aef09faf4befd81a4c2b9c5e2 /engine/Response.php | |
parent | 48d688cdf7f9eae1bf11b8a6f0e5b98687c604cb (diff) |
make it simple, but not simpler
Diffstat (limited to 'engine/Response.php')
-rw-r--r-- | engine/Response.php | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/engine/Response.php b/engine/Response.php deleted file mode 100644 index 6250063..0000000 --- a/engine/Response.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -class Response { - - protected array $headers = []; - - public function __construct( - public int $code = 200, - public ?string $body = null - ) {} - - public function send(): void { - $this->setHeaders(); - if ($this->code == 200 || $this->code >= 400) - echo $this->body; - } - - public function addHeader(string $header): void { - $this->headers[] = $header; - } - - public function setHeaders(): void { - http_response_code($this->code); - foreach ($this->headers as $header) - header($header); - } - -}
\ No newline at end of file |