66
77trait HalJsonResponseTrait
88{
9+ /**
10+ * @param \Psr\Http\Message\ResponseInterface $response
11+ * @return \Psr\Http\Message\ResponseInterface
12+ */
13+ protected function addHeaders (\Psr \Http \Message \ResponseInterface $ response )
14+ {
15+ return $ response ;
16+ }
17+
918 /**
1019 * @param string $json
1120 *
@@ -14,7 +23,7 @@ trait HalJsonResponseTrait
1423 private function errorResponse ($ json )
1524 {
1625 return (new HttpFoundationFactory ())
17- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \ErrorResponse ($ json ));
26+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \ErrorResponse ($ json) ));
1827 }
1928
2029 /**
@@ -25,7 +34,7 @@ private function errorResponse($json)
2534 private function resourceCreatedResponse ($ json )
2635 {
2736 return (new HttpFoundationFactory ())
28- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \ResourceCreatedResponse ($ json ));
37+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \ResourceCreatedResponse ($ json) ));
2938 }
3039
3140 /**
@@ -36,7 +45,7 @@ private function resourceCreatedResponse($json)
3645 private function resourceDeletedResponse ($ json )
3746 {
3847 return (new HttpFoundationFactory ())
39- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \ResourceDeletedResponse ($ json ));
48+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \ResourceDeletedResponse ($ json) ));
4049 }
4150
4251 /**
@@ -47,7 +56,7 @@ private function resourceDeletedResponse($json)
4756 private function resourceNotFoundResponse ($ json )
4857 {
4958 return (new HttpFoundationFactory ())
50- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \ResourceNotFoundResponse ($ json ));
59+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \ResourceNotFoundResponse ($ json) ));
5160 }
5261
5362 /**
@@ -58,7 +67,7 @@ private function resourceNotFoundResponse($json)
5867 private function resourcePatchErrorResponse ($ json )
5968 {
6069 return (new HttpFoundationFactory ())
61- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \ResourcePatchErrorResponse ($ json ));
70+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \ResourcePatchErrorResponse ($ json) ));
6271 }
6372
6473 /**
@@ -69,7 +78,7 @@ private function resourcePatchErrorResponse($json)
6978 private function resourcePostErrorResponse ($ json )
7079 {
7180 return (new HttpFoundationFactory ())
72- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \ResourcePostErrorResponse ($ json ));
81+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \ResourcePostErrorResponse ($ json) ));
7382 }
7483
7584 /**
@@ -80,7 +89,7 @@ private function resourcePostErrorResponse($json)
8089 private function resourceProcessingResponse ($ json )
8190 {
8291 return (new HttpFoundationFactory ())
83- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \ResourceProcessingResponse ($ json ));
92+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \ResourceProcessingResponse ($ json) ));
8493 }
8594
8695 /**
@@ -91,7 +100,7 @@ private function resourceProcessingResponse($json)
91100 private function resourceUpdatedResponse ($ json )
92101 {
93102 return (new HttpFoundationFactory ())
94- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \ResourceUpdatedResponse ($ json ));
103+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \ResourceUpdatedResponse ($ json) ));
95104 }
96105
97106 /**
@@ -102,7 +111,7 @@ private function resourceUpdatedResponse($json)
102111 private function response ($ json )
103112 {
104113 return (new HttpFoundationFactory ())
105- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \Response ($ json ));
114+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \Response ($ json) ));
106115 }
107116
108117 /**
@@ -113,6 +122,6 @@ private function response($json)
113122 private function unsupportedActionResponse ($ json )
114123 {
115124 return (new HttpFoundationFactory ())
116- ->createResponse (new \NilPortugues \Api \HalJson \Http \Message \UnsupportedActionResponse ($ json ));
125+ ->createResponse ($ this -> addHeaders ( new \NilPortugues \Api \HalJson \Http \Message \UnsupportedActionResponse ($ json) ));
117126 }
118127}
0 commit comments