ThemeController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 3
c 3
b 1
f 0
lcom 1
cbo 2
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A switchAction() 0 8 2
1
<?php
2
3
namespace Neirda\Bundle\LiipThemeProvider\Controller;
4
5
use Neirda\Bundle\LiipThemeProvider\Theme\ThemeContainerInterface;
6
use Liip\ThemeBundle\ActiveTheme;
7
use Liip\ThemeBundle\Controller\ThemeController as Base;
8
use Symfony\Component\HttpFoundation\Request;
9
10
class ThemeController extends Base
11
{
12
    /**
13
     * @var null|ThemeContainerInterface
14
     */
15
    protected $themeContainer = null;
16
17
    /**
18
     * {@inheritdoc}
19
     * @param null|ThemeContainerInterface $themeContainer
20
     */
21
    public function __construct(ActiveTheme $activeTheme, array $themes, array $cookieOptions, ThemeContainerInterface $themeContainer = null)
22
    {
23
        $this->themeContainer = $themeContainer;
24
        parent::__construct($activeTheme, $themes, $cookieOptions);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function switchAction(Request $request)
31
    {
32
        if ($this->themeContainer instanceof ThemeContainerInterface) {
33
            $this->themes = $this->themeContainer->getThemeList();
34
        }
35
36
        return parent::switchAction($request);
37
    }
38
}
39