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

SecurityController::logout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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