Passed
Push — master ( 68b437...eb1a97 )
by Mike
08:08
created

TwigConfig::getModulePaths()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 17
ccs 13
cts 13
cp 1
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Xervice\Twig;
6
7
8
use Xervice\Config\Business\XerviceConfig;
9
use Xervice\Core\Business\Model\Config\AbstractConfig;
10
use Xervice\Core\CoreConfig;
11
12
class TwigConfig extends AbstractConfig
13
{
14
    public const DEBUG = 'twig.debug';
15
16
    public const CHARSET = 'twig.charset';
17
18
    public const BASE_TEMPLATE_CLASS = 'twig.base.template.class';
19
20
    public const STRICT_VARIABLES = 'twig.strict.variables';
21
22
    public const AUTOESCAPE = 'twig.autoescape';
23
24
    public const CACHE = 'twig.cache';
25
26
    public const CACHE_PATH = 'twig.cache.path';
27
28
    public const AUTO_RELOAD = 'twig.auto.reload';
29
30
    public const OPTIMIZATIONS = 'twig.optimizations';
31
32
    public const MODULE_PATHS = 'twig.module.paths';
33
34
    /**
35
     * @return array
36
     */
37 2
    public function getModulePaths(): array
38
    {
39 2
        return $this->get(
40 2
            self::MODULE_PATHS,
41
            [
42 2
                sprintf(
43 2
                    '%s/src/*',
44 2
                    $this->get(XerviceConfig::APPLICATION_PATH)
45
                ),
46 2
                sprintf(
47 2
                    '%s/src/%s',
48 2
                    $this->get(XerviceConfig::APPLICATION_PATH),
49 2
                    'Xervice'
50
                ),
51 2
                sprintf(
52 2
                    '%s/vendor/xervice/*/src/Xervice',
53 2
                    $this->get(XerviceConfig::APPLICATION_PATH)
54
                )
55
            ]
56
        );
57
    }
58
59
    /**
60
     * @return bool
61
     */
62 2
    public function isDebug(): bool
63
    {
64 2
        return $this->get(self::DEBUG, false);
65
    }
66
67
    /**
68
     * @return string
69
     */
70 2
    public function getCharset(): string
71
    {
72 2
        return $this->get(self::CHARSET, 'UTF-8');
73
    }
74
75
    /**
76
     * @return string
77
     */
78 2
    public function getBaseTemplateClass(): string
79
    {
80 2
        return $this->get(self::BASE_TEMPLATE_CLASS, 'Twig_Template');
81
    }
82
83
    /**
84
     * @return bool
85
     */
86 2
    public function isStrictVariables(): bool
87
    {
88 2
        return $this->get(self::STRICT_VARIABLES, false);
89
    }
90
91
    /**
92
     * @return string
93
     */
94 2
    public function getAutoescape(): string
95
    {
96 2
        return $this->get(self::AUTOESCAPE, 'html');
97
    }
98
99
    /**
100
     * @return bool
101
     */
102 2
    public function isCache(): bool
103
    {
104 2
        return $this->get(self::CACHE, false);
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function getCachePath(): string
111
    {
112
        return $this->get(self::CACHE_PATH);
113
    }
114
115
    /**
116
     * @return bool
117
     */
118 2
    public function isAutoReload(): bool
119
    {
120 2
        return $this->get(self::AUTO_RELOAD, false);
121
    }
122
123
    /**
124
     * @return int
125
     */
126 2
    public function getOptimization(): int
127
    {
128 2
        return $this->get(self::OPTIMIZATIONS, -1);
129
    }
130
}