2023-10-17 14:50:46 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Kiri\Router\Format;
|
|
|
|
|
|
2023-11-03 17:44:38 +08:00
|
|
|
use Kiri\Di\Inject\Container;
|
2023-10-17 14:50:46 +08:00
|
|
|
use Kiri\Router\Constrict\Stream;
|
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
|
|
|
|
|
|
class OtherFormat implements IFormat
|
|
|
|
|
{
|
|
|
|
|
|
2024-12-16 16:29:35 +08:00
|
|
|
|
|
|
|
|
public function __construct(public ResponseInterface $response)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-10-17 14:50:46 +08:00
|
|
|
* @param mixed $result
|
|
|
|
|
* @return ResponseInterface
|
|
|
|
|
*/
|
|
|
|
|
public function call(mixed $result): ResponseInterface
|
|
|
|
|
{
|
2024-12-16 16:29:35 +08:00
|
|
|
return $this->response->withBody(new Stream($result));
|
2023-10-17 14:50:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|