SecurityController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A renderLogin() 0 20 3
1
<?php
2
3
namespace Alpixel\Bundle\UserBundle\Controller;
4
5
use FOS\UserBundle\Controller\SecurityController as BaseController;
6
use Symfony\Component\HttpFoundation\Request;
7
8
class SecurityController extends BaseController
9
{
10
    public function renderLogin(array $data)
11
    {
12
        $request = $this->container->get('request_stack')->getCurrentRequest();
13
14
        $template = 'AlpixelUserBundle:admin:page/login.html.twig';
15
16
        $firewallTemplates = $this->container->getParameter('alpixel_user.firewall_templates');
17
        foreach ($firewallTemplates as $templateParam) {
18
            $path = str_replace('/'.$request->getLocale(), '', $request->getPathInfo());
19
            if ($templateParam['login_path'] === $path) {
20
                $template = $templateParam['login_template'];
21
                break;
22
            }
23
        }
24
25
        return $this->container->get('templating')->renderResponse($template, array_merge($data, [
26
            'background_image' => $this->container->getParameter('alpixel_user.default_login_background_image'),
27
            'color'            => $this->container->getParameter('alpixel_user.default_login_background_color'),
28
        ]));
29
    }
30
}
31