| Conditions | 1 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | #[Route("/api/lucky/number")] |
||
| 12 | public function jsonNumber(): Response |
||
| 13 | { |
||
| 14 | $number = random_int(0, 100); |
||
| 15 | |||
| 16 | $data = [ |
||
| 17 | 'lucky-number' => $number, |
||
| 18 | 'lucky-message' => 'Hi there!', |
||
| 19 | ]; |
||
| 20 | |||
| 21 | // return new JsonResponse($data); |
||
| 22 | |||
| 23 | $response = new JsonResponse($data); |
||
| 24 | $response->setEncodingOptions( |
||
| 25 | $response->getEncodingOptions() | JSON_PRETTY_PRINT |
||
| 26 | ); |
||
| 27 | return $response; |
||
| 28 | } |
||
| 30 |