Utils::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of TwigView.
6
 *
7
 ** (c) 2014 Cees-Jan Kiewiet
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace WyriHaximus\TwigView\Lib\Twig\Extension;
14
15
use Twig\Extension\AbstractExtension;
16
use Twig\TwigFilter;
17
18
/**
19
 * Class Utils.
20
 * @package WyriHaximus\TwigView\Lib\Twig\Extension
21
 */
22
final class Utils extends AbstractExtension
23
{
24
    /**
25
     * Get declared filters.
26
     *
27
     * @return \Twig\TwigFilter[]
28
     */
29
    public function getFilters(): array
30
    {
31
        return [
32
            new TwigFilter('serialize', 'serialize'),
33
            new TwigFilter('unserialize', 'unserialize'),
34
            new TwigFilter('md5', 'md5'),
35
            new TwigFilter('base64_encode', 'base64_encode'),
36
            new TwigFilter('base64_decode', 'base64_decode'),
37
            new TwigFilter('nl2br', 'nl2br'),
38
            new TwigFilter('string', function ($str) {
39
                return (string)$str;
40
            }),
41
        ];
42
    }
43
44
    /**
45
     * Get extension name.
46
     *
47
     * @return string
48
     */
49
    public function getName(): string
50
    {
51
        return 'utils';
52
    }
53
}
54