22 lines
527 B
PHP
22 lines
527 B
PHP
<?php
|
|
|
|
namespace engine\http;
|
|
|
|
class HtmlResponse
|
|
extends Response
|
|
{
|
|
public function __construct(string $html,
|
|
HTTPCode $code = HTTPCode::OK,
|
|
protected string $contentType = 'text/html; charset=utf-8') {
|
|
parent::__construct($code);
|
|
$this->data = $html;
|
|
}
|
|
|
|
public function getBody(): string {
|
|
return $this->data;
|
|
}
|
|
|
|
public function getHeaders(): ?array {
|
|
return ['Content-Type: '.$this->contentType];
|
|
}
|
|
} |