Publiczna aplikacja fdmtech.pl: renderer CMS, formularz audytu, szablony i logotypy
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FDMTech;
|
||||
|
||||
final class Response
|
||||
{
|
||||
public function __construct(public int $status, public string $body = '', public array $headers = []) {}
|
||||
|
||||
public function send(bool $head = false): void
|
||||
{
|
||||
http_response_code($this->status);
|
||||
foreach ($this->headers as $name => $value) {
|
||||
header($name . ': ' . $value);
|
||||
}
|
||||
if (!$head) {
|
||||
echo $this->body;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user