Completed
Pull Request — master (#74)
by AD
10:05
created

Basic::getFunctions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of TwigView.
4
 *
5
 ** (c) 2014 Cees-Jan Kiewiet
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace WyriHaximus\TwigView\Lib\Twig\Extension;
12
13
use Twig\Extension\AbstractExtension;
14
use Twig\TwigFilter;
15
16
/**
17
 * Class Basic.
18
 * @package WyriHaximus\TwigView\Lib\Twig\Extension
19
 */
20
final class Basic extends AbstractExtension
21
{
22
    /**
23
     * Get declared filters.
24
     *
25
     * @return \Twig\TwigFilter[]
26
     */
27 4
    public function getFilters(): array
28
    {
29
        return [
30 4
            new TwigFilter('debug', 'debug'),
31 4
            new TwigFilter('pr', 'pr'),
32 4
            new TwigFilter('env', 'env'),
33 4
            new TwigFilter('count', 'count'),
34 4
            new TwigFilter('h', 'h'),
35 4
            new TwigFilter('null', function () {
36
                return '';
37 4
            }),
38
        ];
39
    }
40
    
41
    /**
42
     * Get declared functions.
43
     *
44
     * @return \Twig\TwigFunction[]
45
     */
46 1
    public function getFunctions(): array
47
    {
48 1
        return [
49
            new TwigFunction('config', 'Cake\Core\Configure::read'),
50
        ];
51
    }
52
    
53
    /**
54
     * Get extension name.
55
     *
56
     * @return string
57
     */
58
    public function getName(): string
59
    {
60
        return 'basic';
61
    }
62
}
63