HtmlExtension::getFilters()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 10
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 16
ccs 15
cts 15
cp 1
crap 1
rs 9.9332
1
<?php
2
3
/*
4
 * This file is part of ocubom/twig-html-extension
5
 *
6
 * © Oscar Cubo Medina <https://ocubom.github.io>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ocubom\Twig\Extension;
13
14
use Twig\Extension\AbstractExtension;
15
use Twig\TwigFilter;
16
17
class HtmlExtension extends AbstractExtension
18
{
19 8
    public function getFilters(): array
20
    {
21 8
        return [
22 8
            new TwigFilter(
23 8
                'html_attributes',
24 8
                [HtmlAttributesRuntime::class, '__invoke'],
25 8
                [
26 8
                    'is_safe' => ['html'],
27 8
                ]
28 8
            ),
29 8
            new TwigFilter(
30 8
                'html_compress',
31 8
                [HtmlCompressRuntime::class, '__invoke'],
32 8
                [
33 8
                    'is_safe' => ['html'],
34 8
                    'needs_environment' => true,
35 8
                ]
36 8
            ),
37 8
        ];
38
    }
39
}
40