| Conditions | 4 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | 95 | protected function creatResponse($data = null, int $status = Response::HTTP_OK, bool $json = false, array $headers = []): Response |
|
| 48 | { |
||
| 49 | 95 | if ($json && !\is_string($json)) { |
|
| 50 | 61 | $data = $this->serializer->serialize($data, 'json'); |
|
| 51 | } |
||
| 52 | |||
| 53 | 95 | if ($json) { |
|
| 54 | 61 | $headers['Content-Type'] = 'application/json'; |
|
| 55 | } |
||
| 56 | |||
| 57 | 95 | return new Response($data, $status, $headers); |
|
| 58 | } |
||
| 60 |