| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 3 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function getResponse(string $json, int $responseCode = JSONApiInterface::HTTP_RESPONSE_CODE_OK) : Response |
||
| 20 | { |
||
| 21 | if ($responseCode === JSONApiInterface::HTTP_RESPONSE_CODE_NO_CONTENT) { |
||
| 22 | // ! it is important to pass empty string here, otherwise there will be Exception from ResponseFactory |
||
| 23 | // seems like a bug in Laravel - either don't have time to report them and don't like their PR rules |
||
| 24 | return response('')->withHeaders(JSONApiInterface::STANDARD_HEADERS)->setStatusCode($responseCode); |
||
| 25 | } |
||
| 26 | |||
| 27 | return response($json)->withHeaders(JSONApiInterface::STANDARD_HEADERS)->setStatusCode($responseCode); |
||
| 28 | } |
||
| 29 | } |