This commit is contained in:
2021-11-30 18:04:41 -03:00
parent 87323b22d8
commit f589ff960b
56 changed files with 1960 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<?php
namespace Incoviba\API\Common\Define\Controller;
use Psr\Http\Message\ResponseInterface as Response;
trait Json {
public function withJson(Response $response, $data, $status = 200): Response {
$response->getBody()->write(json_encode($data, JSON_UNESCAPED_SLASHES));
return $response
->withStatus($status)
->withHeader('content-type', 'application/json');
}
}