Passed
Push — fix_coverage_in_scrutinizer ( cd0379...a04ba4 )
by Herberto
13:22
created

SecurityController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 28
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A login() 0 9 1
A logout() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Controller;
13
14
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
15
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
16
use Symfony\Component\HttpFoundation\Response;
17
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
18
19
/**
20
 * Controller used to manage the application security.
21
 * See https://symfony.com/doc/current/cookbook/security/form_login_setup.html.
22
 *
23
 * @author Ryan Weaver <[email protected]>
24
 * @author Javier Eguiluz <[email protected]>
25
 */
26
class SecurityController extends AbstractController
27
{
28
    /**
29
     * @Route("/login", name="security_login")
30
     */
31 1
    public function login(AuthenticationUtils $helper): Response
32
    {
33 1
        return $this->render('security/login.html.twig', [
34
            // last username entered by the user (if any)
35 1
            'last_username' => $helper->getLastUsername(),
36
            // last authentication error (if any)
37 1
            'error' => $helper->getLastAuthenticationError(),
38
        ]);
39
    }
40
41
    /**
42
     * This is the route the user can use to logout.
43
     *
44
     * But, this will never be executed. Symfony will intercept this first
45
     * and handle the logout automatically. See logout in app/config/security.yml
46
     *
47
     * @Route("/logout", name="security_logout")
48
     */
49
    public function logout(): void
50
    {
51
        throw new \Exception('This should never be reached!');
52
    }
53
}
54