TwigExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
c 2
b 0
f 0
dl 0
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 5 1
1
<?php
2
3
namespace PiedWeb\RenderAttributes;
4
5
use Twig\Extension\AbstractExtension;
6
use Twig\TwigFunction;
7
8
/**
9
 * Transform an array in html tag attributes
10
 * Twig Extension
11
 * PSR-2 Coding Style, PSR-4 Autoloading.
12
 *
13
 * @author     Robin <[email protected]> https://piedweb.com
14
 *
15
 * @see       https://github.com/PiedWeb/render-html-attributes
16
 * @since      File available since 2018.11.12
17
 */
18
class TwigExtension extends AbstractExtension
19
{
20
    use AttributesTrait;
21
22
    public function getFunctions()
23
    {
24
        return [
25
            new TwigFunction('mergeAttr', [self::class, 'mergeAndMapAttributes'], ['is_safe' => ['html']]),
26
            new TwigFunction('attr', [self::class, 'mapAttributes'], ['is_safe' => ['html']]),
27
        ];
28
    }
29
}
30