Passed
Push — main ( a57e19...f52e71 )
by Vedrana
28:10
created

LuckyController::hello()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

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 3
cts 3
cp 1
crap 1
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 1
    #[Route('/lucky/number')]
19
    public function number(): Response
20
    {
21 1
        $number = random_int(0, 100);
22
23 1
        return new Response(
24 1
            '<html><body>Lucky number: '.$number.'</body></html>'
25 1
        );
26
    }
27
28
    /**
29
     * Returns a simple HTML response with hello message.
30
     *
31
     * @return Response
32
     */
33 1
    #[Route("/lucky/hello")]
34
    public function hello(): Response
35
    {
36 1
        return new Response(
37 1
            '<html><body>Hello to you!</body></html>'
38 1
        );
39
    }
40
}
41