Completed
Push — master ( 4207f0...333332 )
by Kamil
23:19 queued 01:42
created

ThemeContext::getThemeHierarchy()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 2
eloc 2
nc 2
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\ThemeBundle\Context;
13
14
use Sylius\Bundle\ThemeBundle\HierarchyProvider\ThemeHierarchyProviderInterface;
15
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
16
17
/**
18
 * @author Kamil Kokot <[email protected]>
19
 */
20
final class ThemeContext implements ThemeContextInterface
21
{
22
    /**
23
     * @var ThemeHierarchyProviderInterface
24
     */
25
    private $themeHierarchyProvider;
26
27
    /**
28
     * @var ThemeInterface
29
     */
30
    private $theme;
31
32
    /**
33
     * @param ThemeHierarchyProviderInterface $themeHierarchyProvider
34
     */
35
    public function __construct(ThemeHierarchyProviderInterface $themeHierarchyProvider)
36
    {
37
        $this->themeHierarchyProvider = $themeHierarchyProvider;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function setTheme(ThemeInterface $theme)
44
    {
45
        $this->theme = $theme;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getTheme()
52
    {
53
        return $this->theme;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getThemeHierarchy()
60
    {
61
        return null !== $this->theme ? $this->themeHierarchyProvider->getThemeHierarchy($this->theme) : [];
62
    }
63
}
64