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
|
|
|
|