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