Replaced all FQ global function and constants by explicit imports

This commit is contained in:
Alejandro Celaya
2018-10-28 08:24:06 +01:00
parent e1222de05b
commit 77d810b735
70 changed files with 235 additions and 123 deletions

View File

@@ -7,7 +7,10 @@ use Acelaya\ExpressiveErrorHandler\ErrorHandler\ErrorResponseGeneratorInterface;
use Fig\Http\Message\StatusCodeInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Throwable;
use Zend\Diactoros\Response\JsonResponse;
use function str_replace;
use function strtoupper;
class JsonErrorResponseGenerator implements ErrorResponseGeneratorInterface, StatusCodeInterface
{
@@ -20,7 +23,7 @@ class JsonErrorResponseGenerator implements ErrorResponseGeneratorInterface, Sta
* @return Response
* @throws \InvalidArgumentException
*/
public function __invoke(?\Throwable $e, Request $request, Response $response)
public function __invoke(?Throwable $e, Request $request, Response $response)
{
$status = $response->getStatusCode();
$responsePhrase = $status < 400 ? 'Internal Server Error' : $response->getReasonPhrase();
@@ -34,6 +37,6 @@ class JsonErrorResponseGenerator implements ErrorResponseGeneratorInterface, Sta
private function responsePhraseToCode(string $responsePhrase): string
{
return \strtoupper(\str_replace(' ', '_', $responsePhrase));
return strtoupper(str_replace(' ', '_', $responsePhrase));
}
}