ringfinger/backend/classes/api/ApiSvgResponse.php
2020-08-23 12:37:39 +02:00

27 lines
481 B
PHP

<?php
declare(strict_types=1);
final class ApiSvgResponse extends ApiResponse
{
private string $content;
protected string $mimeType = MimeType::SVG;
public function __construct(int $status = ServerStatus::OK)
{
parent::__construct($status);
}
public function setContent(string $content): void
{
$this->content = $content;
}
public function respond(): void
{
parent::respond();
header('Content-Length: ' . strlen($this->content));
echo $this->content;
}
}