diff --git a/src/Controller/Rest.php b/src/Controller/Rest.php deleted file mode 100644 index 15820df..0000000 --- a/src/Controller/Rest.php +++ /dev/null @@ -1,36 +0,0 @@ -get($name); - } - - public static function isJson($value) - { - if (!is_string($value)) { - return false; - } - - json_decode($value); - - return is_string($value) && (json_last_error() === JSON_ERROR_NONE); - } - - public function json($data) - { - $headers = []; - $headers['content-type'] = 'application/json'; - $payload = static::isJson($data) ? $data : json_encode($data); - - return new Response(200, $headers, $payload); - } -} diff --git a/src/Dispatcher.php b/src/Dispatcher.php index 7fd65c0..c5267d3 100644 --- a/src/Dispatcher.php +++ b/src/Dispatcher.php @@ -28,7 +28,7 @@ public function __construct(iterable $middleware) public function dispatch(ServerRequestInterface $request): ResponseInterface { - return $this->handle($request)->withHeader('X-Powered-By', 'YPF/'.Application::VERSION); + return $this->handle($request)->withHeader('X-Powered-By', 'YPF/' . Application::VERSION); } public function handle(ServerRequestInterface $request): ResponseInterface