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