From f7bfdf58def6aadc922e1632f407d1418269a0d7 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 9 Jul 2022 19:40:17 +0300 Subject: initial --- engine/Response.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 engine/Response.php (limited to 'engine/Response.php') diff --git a/engine/Response.php b/engine/Response.php new file mode 100644 index 0000000..6250063 --- /dev/null +++ b/engine/Response.php @@ -0,0 +1,28 @@ +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 -- cgit v1.2.3