This commit is contained in:
2022-11-25 20:52:52 -03:00
parent dd0410a0fb
commit efed50cd7f
39 changed files with 2777 additions and 5 deletions

View File

@ -0,0 +1,16 @@
<?php
namespace ProVM\Common\Implement\Controller;
use Psr\Http\Message\ResponseInterface;
trait Json
{
public function withJson(ResponseInterface $response, mixed $data, int $status = 200): ResponseInterface
{
$response->getBody()->write(\Safe\json_encode($data));
return $response
->withStatus($status)
->withHeader('Content-Type', 'application/json');
}
}