| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 36 | public function getAll(): Response |
||
| 37 | { |
||
| 38 | $categories = $this->categoryRepository->getAll(); |
||
| 39 | |||
| 40 | if ($categories === null) { |
||
| 41 | $response = new Response('[]'); |
||
| 42 | } else { |
||
| 43 | $json = $this->categoriesSerializer->serialize($categories, 'json'); |
||
| 44 | $response = new Response($json); |
||
| 45 | } |
||
| 46 | |||
| 47 | $response->headers->set('Content-Type', 'application/json'); |
||
| 48 | |||
| 49 | return $response; |
||
| 50 | } |
||
| 52 |