Security   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A placeHolderFunction() 0 3 1
A logout() 0 3 1
A login() 0 9 1
1
<?php
2
3
4
namespace App\User\Communication\Controller;
5
6
7
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8
use Symfony\Component\HttpFoundation\Request;
9
use Symfony\Component\HttpFoundation\Response;
10
use Symfony\Component\Routing\Annotation\Route;
11
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
12
13
class Security extends Controller
14
{
15
    /**
16
     * @Route("/", name="login")
17
     * @param Request             $request
18
     * @param AuthenticationUtils $authenticationUtils
19
     * @return Response
20
     */
21
    public function login(Request $request, AuthenticationUtils $authenticationUtils): Response
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

21
    public function login(/** @scrutinizer ignore-unused */ Request $request, AuthenticationUtils $authenticationUtils): Response

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23
        $error = $authenticationUtils->getLastAuthenticationError();
24
25
        $lastUsername = $authenticationUtils->getLastUsername();
26
27
        return $this->render('user/security/login.html.twig', array(
28
            'last_username' => $lastUsername,
29
            'error'         => $error,
30
        ));
31
    }
32
33
    /**
34
     * This is the route the user can use to logout.
35
     *
36
     * But, this will never be executed. Symfony will intercept this first
37
     * and handle the logout automatically. See logout in config/packages/security.yaml
38
     *
39
     * @Route("/logout", name="logout")
40
     * @throws \Exception
41
     */
42
    public function logout(): void
43
    {
44
        throw new \RuntimeException('This should never be reached!');
45
    }
46
47
    /**
48
     * ONLY A PLACEHOLDER, FOR INDEX PAGE
49
     * @Route("/dashboard", name="dashboard")
50
     *
51
     * @param Request $request
52
     * @return Response
53
     */
54
    public function placeHolderFunction(Request $request): Response
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

54
    public function placeHolderFunction(/** @scrutinizer ignore-unused */ Request $request): Response

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
        return $this->render('base.html.twig');
57
    }
58
}