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

LuckyControllerTwig::number()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\Routing\Annotation\Route;
8
9
/**
10
 * Controller for rendering pages using Twig templates.
11
 */
12
class LuckyControllerTwig extends AbstractController
13
{
14
    /**
15
     * Route that displays a random number.
16
     *
17
     * @return Response
18
     */
19 1
    #[Route("/lucky/twig", name: "lucky")]
20
    public function number(): Response
21
    {
22 1
        $number = random_int(0, 100);
23
24 1
        $data = [
25 1
            'number' => $number
26 1
        ];
27
28 1
        return $this->render('lucky.html.twig', $data);
29
    }
30
31
    /**
32
     * Route for the home page.
33
     *
34
     * @return Response
35
     */
36 1
    #[Route("/", name: "home")]
37
    public function home(): Response
38
    {
39 1
        return $this->render('home.html.twig');
40
    }
41
42
    /**
43
     * Route for the about page.
44
     *
45
     * @return Response
46
     */
47 1
    #[Route("/about", name: "about")]
48
    public function about(): Response
49
    {
50 1
        return $this->render('about.html.twig');
51
    }
52
53
    /**
54
     * Route for the project report page.
55
     *
56
     * @return Response
57
     */
58 1
    #[Route("/report", name: "report")]
59
    public function report(): Response
60
    {
61 1
        return $this->render('report.html.twig');
62
    }
63
64
    /**
65
     * Route for the API.
66
     *
67
     * @return Response
68
     */
69 1
    #[Route("/api", name: "api")]
70
    public function api(): Response
71
    {
72 1
        return $this->render('api.html.twig');
73
    }
74
75
    /**
76
     * Route for the card game landing page.
77
     *
78
     * @return Response
79
     */
80
    #[Route("/card", name: "card")]
81
    public function card(): Response
82
    {
83
        return $this->render('card/home.html.twig');
84
    }
85
86
    /**
87
     * Route for the game 21 landing page.
88
     *
89
     * @return Response
90
     */
91
    #[Route("/game", name: "game")]
92
    public function landningpage(): Response
93
    {
94
        return $this->render('game/home.html.twig');
95
    }
96
97
    /**
98
     * Route for the library.
99
     *
100
     * @return Response
101
     */
102
    #[Route("/library", name: "library")]
103
    public function bookpage(): Response
104
    {
105
        return $this->render('library/index.html.twig');
106
    }
107
108
    /**
109
     * Route for displaying metrics.
110
     *
111
     * @return Response
112
     */
113 1
    #[Route("/metrics", name: "metrics")]
114
    public function metrics(): Response
115
    {
116 1
        return $this->render('metrics.html.twig');
117
    }
118
}
119