for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Uxmp\Core\Api\Lib\Message;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
final class JsonEnabledResponse extends Response implements JsonEnabledResponseInterface
{
public function withJson(mixed $data): ResponseInterface
$this->getBody()->write(
json_encode($data, JSON_THROW_ON_ERROR|JSON_PRETTY_PRINT)
);
return $this->withHeader(
'Content-Type',
'application/json'
}