HtmlExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 18
ccs 15
cts 15
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFilters() 0 16 1
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