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