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