Files
kiri-core/http-helper/Http/Formatter/FileFormatter.php
T

52 lines
691 B
PHP
Raw Normal View History

2021-08-10 16:40:01 +08:00
<?php
2021-08-17 16:43:50 +08:00
namespace Http\Http\Formatter;
2021-08-10 16:40:01 +08:00
use Exception;
2021-08-17 16:43:50 +08:00
use Http\Abstracts\HttpService;
use Http\IInterface\IFormatter;
2021-08-10 16:40:01 +08:00
use Swoole\Http\Response;
/**
*
*/
class FileFormatter extends HttpService implements IFormatter
{
public mixed $data;
/** @var Response */
public Response $status;
public array $header = [];
/**
* @param $context
* @return $this
* @throws Exception
*/
public function send($context): static
{
$this->data = $context;
return $this;
}
/**
* @return mixed
*/
public function getData(): mixed
{
$data = $this->data;
$this->clear();
return $data;
}
public function clear(): void
{
$this->data = null;
unset($this->data);
}
}