Extension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 8 1
A getTokenParsers() 0 6 1
A getName() 0 4 1
1
<?php
2
namespace Rocket\UI\Forms\Support\Twig;
3
4
use Rocket\UI\Forms\Forms;
5
use Twig_Extension;
6
use Twig_SimpleFunction;
7
8
/**
9
 * Form extension for twig
10
 *
11
 * @author Stéphane Goetz
12
 */
13
class Extension extends Twig_Extension
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function getFunctions()
19
    {
20
        return [
21
            new Twig_SimpleFunction('forms_open', [Forms::class, 'open'], ['is_safe' => ['html']]),
22
            new Twig_SimpleFunction('forms_close', [Forms::class, 'close'], ['is_safe' => ['html']]),
23
            new Twig_SimpleFunction('forms_submit', [Forms::class, 'submit'], ['is_safe' => ['html']]),
24
        ];
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getTokenParsers()
31
    {
32
        return [
33
            new TokenParser(),
34
        ];
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getName()
41
    {
42
        return 'form';
43
    }
44
}
45