4in1_ws_web/src/engine/http/HtmlResponse.php
2025-04-28 14:47:25 +03:00

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];
}
}