Completed
Pull Request — develop (#716)
by Agel_Nash
06:26
created

ManagerTheme   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A makePartial() 0 4 1
A getPartial() 0 4 1
1
<?php namespace EvolutionCMS;
2
3
use EvolutionCMS\Interfaces\ManagerThemeInterface;
4
use EvolutionCMS\Interfaces\CoreInterface;
5
6
class ManagerTheme implements ManagerThemeInterface
7
{
8
    /**
9
     * @var CoreInterface
10
     */
11
    protected $core;
12
13
    /**
14
     * @var $theme
15
     */
16
    protected $theme;
17
18
    public function __construct(CoreInterface $core, $theme = '')
19
    {
20
        $this->core = $core;
21
22
        if (empty($theme)) {
23
            $theme = $this->core->getConfig('manager_theme');
24
        }
25
26
        $this->theme = $theme;
27
    }
28
29
    public function makePartial($name)
30
    {
31
        return MODX_MANAGER_PATH . sprintf('media/style/%s/partials/%s.tpl', $this->theme, $name);
32
    }
33
34
    public function getPartial($name)
35
    {
36
        return file_get_contents($this->makePartial($name));
37
    }
38
}
39