ActiveTheme::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
3
namespace Neirda\Bundle\LiipThemeProvider\Theme;
4
5
use Liip\ThemeBundle\ActiveTheme as Base;
6
use Liip\ThemeBundle\Helper\DeviceDetectionInterface;
7
8
class ActiveTheme extends Base
9
{
10
    /**
11
     * @var bool
12
     */
13
    protected $isInitialized = false;
14
15
    /**
16
     * @var ThemeContainerInterface|null
17
     */
18
    protected $themeContainer;
19
20
    /**
21
     * Get ThemeContainer
22
     *
23
     * @return ThemeContainerInterface|null
24
     */
25
    public function getThemeContainer()
26
    {
27
        return $this->themeContainer;
28
    }
29
30
    /**
31
     * Set ThemeContainer
32
     *
33
     * @param ThemeContainerInterface|null $themeContainer
34
     *
35
     * @return $this
36
     */
37
    public function setThemeContainer(ThemeContainerInterface $themeContainer = null)
38
    {
39
        $this->themeContainer = $themeContainer;
40
41
        return $this;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function __construct($name, array $themes = array(), DeviceDetectionInterface $deviceDetection = null)
48
    {
49
        parent::__construct($name, $themes, $deviceDetection);
50
    }
51
52
    /**
53
     * Initialize the theme list.
54
     */
55
    public function init()
56
    {
57
        if (!$this->isInitialized) {
58
            $this->setThemes($this->themeContainer->getThemeList());
59
            $this->isInitialized = true;
60
        }
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function getThemes()
67
    {
68
        $this->init();
69
        return parent::getThemes();
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function setName($name)
76
    {
77
        $this->init();
78
        parent::setName($name);
79
    }
80
}
81