Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | #[Route("/api/lucky/number")] |
||
30 | public function jsonNnumber(): Response |
||
31 | { |
||
32 | $this->number = random_int(0, 100); |
||
33 | |||
34 | $data = [ |
||
35 | 'lucky-number' => $this->number, |
||
|
|||
36 | 'lucky-message' => 'Hi there!', |
||
37 | ]; |
||
38 | |||
39 | |||
40 | $response = new JsonResponse($data); |
||
41 | $response->setEncodingOptions( |
||
42 | $response->getEncodingOptions() | JSON_PRETTY_PRINT |
||
43 | ); |
||
44 | return $response; |
||
45 | |||
55 |