This commit is contained in:
2024-12-16 16:29:35 +08:00
parent daa02a6408
commit dc561cec9b
7 changed files with 89 additions and 49 deletions
+18 -8
View File
@@ -9,14 +9,24 @@ use Psr\Http\Message\ResponseInterface;
class ArrayFormat implements IFormat
{
/**
* @param $result
* @return ResponseInterface
*/
public function call($result): ResponseInterface
{
return di(ResponseInterface::class)->withBody(new Stream(json_encode($result, JSON_UNESCAPED_UNICODE)));
}
/**
* @param ResponseInterface $response
*/
public function __construct(public ResponseInterface $response)
{
}
/**
* @param $result
*
* @return ResponseInterface
*/
public function call($result): ResponseInterface
{
return $this->response->withBody(new Stream(json_encode($result, JSON_UNESCAPED_UNICODE)));
}
}