Completed
Push — master ( 89c941...5b3aee )
by
unknown
10s
created

AbstractSecurityController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loginAction() 0 12 1
A getAuthenticationUtils() 0 4 1
1
<?php
2
3
namespace Smart\AuthenticationBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
8
9
/**
10
 * @author Nicolas Bastien <[email protected]>
11
 */
12
class AbstractSecurityController extends Controller
13
{
14
    /**
15
     * Define application context, override this in your controller
16
     * @var string
17
     */
18
    protected $context;
19
    
20
    /**
21
     * @return Response
22
     */
23
    public function loginAction()
24
    {
25
        $helper = $this->getAuthenticationUtils();
26
27
        return $this->render($this->context . '/security/login.html.twig', [
28
            'last_username' => $helper->getLastUsername(),
29
            'error'         => $helper->getLastAuthenticationError(),
30
            'layout_template' => $this->context . '/empty_layout.html.twig',
31
            'security_login_check_url' => $this->generateUrl($this->context . '_security_login_check'),
32
//            'security_forgot_password_url' => $this->generateUrl($this->context . '_security_forgot_password'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
33
        ]);
34
    }
35
36
    /**
37
     * @return AuthenticationUtils
38
     */
39
    private function getAuthenticationUtils()
40
    {
41
        return $this->get('security.authentication_utils');
42
    }
43
}
44