SecurityController::renderLogin()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 3
eloc 12
nc 3
nop 1
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