UserController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 22
ccs 0
cts 15
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A login() 0 14 2
A logout() 0 3 1
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