ringfinger/backend/classes/api/ApiSvgResponse.php

27 lines
544 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;
}
}