UserController::logout()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace PiedWeb\CMSBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
8
9
class UserController extends AbstractController
10
{
11
    public function login(AuthenticationUtils $authenticationUtils): Response
12
    {
13
        if ($this->getUser()) {
14
            return $this->redirectToRoute('piedweb_cms_admin_dashboard');
15
        }
16
17
        // get the login error if there is one
18
        $error = $authenticationUtils->getLastAuthenticationError();
19
        // last username entered by the user
20
        $lastUsername = $authenticationUtils->getLastUsername();
21
22
        return $this->render('@PiedWebCMS/user/login.html.twig', [
23
            'last_username' => $lastUsername,
24
            'error' => $error,
25
        ]);
26
    }
27
28
    public function logout()
29
    {
30
        throw new \LogicException('This method can be blank');
31
    }
32
}
33