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

ThemeContext   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 6
Bugs 1 Features 1
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 44
rs 10
c 6
b 1
f 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setTheme() 0 4 1
A getTheme() 0 4 1
A getThemeHierarchy() 0 4 2
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