Passed
Branch main (02626f)
by Vedrana
05:25
created

LuckyController::hello()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace App\Controller;
4
5
use Symfony\Component\HttpFoundation\Response;
6
use Symfony\Component\Routing\Annotation\Route;
7
8
/**
9
 * Controller that provides lucky number and hello page.
10
 */
11
class LuckyController
12
{
13
    /**
14
     * Returns a simple HTML response displaying a random lucky number between 0 and 100.
15
     *
16
     * @return Response
17
     */
18
    #[Route('/lucky/number')]
19
    public function number(): Response
20
    {
21
        $number = random_int(0, 100);
22
23
        return new Response(
24
            '<html><body>Lucky number: '.$number.'</body></html>'
25
        );
26
    }
27
28
    /**
29
     * Returns a simple HTML response with hello message.
30
     *
31
     * @return Response
32
     */
33
    #[Route("/lucky/hello")]
34
    public function hello(): Response
35
    {
36
        return new Response(
37
            '<html><body>Hello to you!</body></html>'
38
        );
39
    }
40
}
41