Passed
Push — master ( f28aa5...f8cd9d )
by Mike
08:28
created

TwigConfig   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 90
ccs 16
cts 18
cp 0.8889
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getBaseTemplateClass() 0 3 1
A isCache() 0 3 1
A getCachePath() 0 3 1
A isStrictVariables() 0 3 1
A isDebug() 0 3 1
A getOptimization() 0 3 1
A getAutoescape() 0 3 1
A isAutoReload() 0 3 1
A getCharset() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Xervice\Twig;
6
7
8
use Xervice\Core\Config\AbstractConfig;
9
10
class TwigConfig extends AbstractConfig
11
{
12
    public const DEBUG = 'debug';
13
14
    public const CHARSET = 'charset';
15
16
    public const BASE_TEMPLATE_CLASS = 'base.template.class';
17
18
    public const STRICT_VARIABLES = 'strict.variables';
19
20
    public const AUTOESCAPE = 'autoescape';
21
22
    public const CACHE = 'cache';
23
24
    public const CACHE_PATH = 'cache.path';
25
26
    public const AUTO_RELOAD = 'auto.reload';
27
28
    public const OPTIMIZATIONS = 'optimizations';
29
30
    /**
31
     * @return bool
32
     */
33 2
    public function isDebug(): bool
34
    {
35 2
        return $this->get(self::DEBUG, false);
36
    }
37
38
    /**
39
     * @return string
40
     */
41 2
    public function getCharset(): string
42
    {
43 2
        return $this->get(self::CHARSET, 'UTF-8');
44
    }
45
46
    /**
47
     * @return string
48
     */
49 2
    public function getBaseTemplateClass(): string
50
    {
51 2
        return $this->get(self::BASE_TEMPLATE_CLASS, 'Twig_Template');
52
    }
53
54
    /**
55
     * @return bool
56
     */
57 2
    public function isStrictVariables(): bool
58
    {
59 2
        return $this->get(self::STRICT_VARIABLES, false);
60
    }
61
62
    /**
63
     * @return string
64
     */
65 2
    public function getAutoescape(): string
66
    {
67 2
        return $this->get(self::AUTOESCAPE, 'html');
68
    }
69
70
    /**
71
     * @return bool
72
     */
73 2
    public function isCache(): bool
74
    {
75 2
        return $this->get(self::CACHE, false);
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getCachePath(): string
82
    {
83
        return $this->get(self::CACHE_PATH);
84
    }
85
86
    /**
87
     * @return bool
88
     */
89 2
    public function isAutoReload(): bool
90
    {
91 2
        return $this->get(self::AUTO_RELOAD, false);
92
    }
93
94
    /**
95
     * @return int
96
     */
97 2
    public function getOptimization(): int
98
    {
99 2
        return $this->get(self::OPTIMIZATIONS, -1);
100
    }
101
}