Completed
Pull Request — develop (#716)
by Serg
06:34
created

ManagerTheme::makePartial()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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