ringfinger/backend/classes/api/ApiSvgResponse.php

27 lines
481 B
PHP
Raw Permalink Normal View History

2020-08-17 23:46:58 +02:00
<?php
declare(strict_types=1);
final class ApiSvgResponse extends ApiResponse
{
2020-08-23 12:37:39 +02:00
private string $content;
protected string $mimeType = MimeType::SVG;
2020-08-17 23:46:58 +02:00
2020-08-23 12:37:39 +02:00
public function __construct(int $status = ServerStatus::OK)
{
parent::__construct($status);
}
2020-08-17 23:46:58 +02:00
2020-08-23 12:37:39 +02:00
public function setContent(string $content): void
{
$this->content = $content;
}
2020-08-17 23:46:58 +02:00
2020-08-23 12:37:39 +02:00
public function respond(): void
{
parent::respond();
header('Content-Length: ' . strlen($this->content));
echo $this->content;
}
2020-08-17 23:46:58 +02:00
}