2
2
3
3
namespace Reconmap \Controllers ;
4
4
5
- use Fig \Http \Message \StatusCodeInterface ;
6
5
use GuzzleHttp \Psr7 \Response ;
7
6
use League \Container \ContainerAwareInterface ;
8
7
use League \Container \ContainerAwareTrait ;
@@ -48,27 +47,27 @@ public function getJsonBodyDecodedAsArray(ServerRequestInterface $request): arra
48
47
49
48
protected function createInternalServerErrorResponse (): ResponseInterface
50
49
{
51
- return (new Response ())->withStatus (StatusCodeInterface:: STATUS_INTERNAL_SERVER_ERROR );
50
+ return (new Response ())->withStatus (\ Symfony \ Component \ HttpFoundation \Response:: HTTP_INTERNAL_SERVER_ERROR );
52
51
}
53
52
54
53
protected function createForbiddenResponse (): ResponseInterface
55
54
{
56
- return (new Response ())->withStatus (StatusCodeInterface:: STATUS_FORBIDDEN );
55
+ return (new Response ())->withStatus (\ Symfony \ Component \ HttpFoundation \Response:: HTTP_FORBIDDEN );
57
56
}
58
57
59
58
protected function createNoContentResponse (): ResponseInterface
60
59
{
61
- return (new Response ())->withStatus (StatusCodeInterface:: STATUS_NO_CONTENT );
60
+ return (new Response ())->withStatus (\ Symfony \ Component \ HttpFoundation \Response:: HTTP_NO_CONTENT );
62
61
}
63
62
64
63
protected function createBadRequestResponse (): ResponseInterface
65
64
{
66
- return (new Response ())->withStatus (StatusCodeInterface:: STATUS_BAD_REQUEST );
65
+ return (new Response ())->withStatus (\ Symfony \ Component \ HttpFoundation \Response:: HTTP_BAD_REQUEST );
67
66
}
68
67
69
68
protected function createNotFoundResponse (): ResponseInterface
70
69
{
71
- return (new Response ())->withStatus (StatusCodeInterface:: STATUS_NOT_FOUND );
70
+ return (new Response ())->withStatus (\ Symfony \ Component \ HttpFoundation \Response:: HTTP_NOT_FOUND );
72
71
}
73
72
74
73
protected function createDeletedResponse (): ResponseInterface
@@ -78,15 +77,15 @@ protected function createDeletedResponse(): ResponseInterface
78
77
79
78
protected function createOkResponse (): ResponseInterface
80
79
{
81
- return (new Response ())->withStatus (StatusCodeInterface:: STATUS_OK );
80
+ return (new Response ())->withStatus (\ Symfony \ Component \ HttpFoundation \Response:: HTTP_OK );
82
81
}
83
82
84
83
protected function createStatusCreatedResponse (string |array |object $ body ): ResponseInterface
85
84
{
86
85
$ jsonBody = is_string ($ body ) ? $ body : json_encode ($ body );
87
86
88
87
$ response = (new Response ())
89
- ->withStatus (StatusCodeInterface:: STATUS_CREATED )
88
+ ->withStatus (\ Symfony \ Component \ HttpFoundation \Response:: HTTP_CREATED )
90
89
->withHeader ('Content-type ' , 'application/json ' );
91
90
$ response ->getBody ()->write ($ jsonBody );
92
91
return $ response ;
0 commit comments