Extension::getFunctions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 8
cp 0
crap 2
rs 10
c 0
b 0
f 0
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