Completed
Pull Request — develop (#716)
by Agel_Nash
07:00
created

ManagerTheme::pathElement()   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 2
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
        $this->loadSnippets();
29
    }
30
31
    public function loadSnippets()
32
    {
33
        $this->core->addSnippet('recentInfoList', $this->pathElement('snippet', 'welcome/RecentInfo'));
34
    }
35
36
    public function pathSnipe($name)
37
    {
38
        return MODX_MANAGER_PATH . sprintf('media/style/%s/chunks/%s.tpl', $this->theme, $name);
39
    }
40
41
    public function pathElement($type, $name)
42
    {
43
        return MODX_MANAGER_PATH . sprintf('media/style/%s/%s/%s.tpl', $this->theme, $type, $name);
44
    }
45
46
    public function getChunk($name)
47
    {
48
        return file_get_contents($this->pathChunk('chunks', $name));
0 ignored issues
show
Bug introduced by
The method pathChunk() does not seem to exist on object<EvolutionCMS\ManagerTheme>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
49
    }
50
}
51