Completed
Push — develop ( db1330...4c826f )
by Jens
14:33 queued 08:19
created

HandlebarsTwigExtension::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace JaySDe\HandlebarsBundle\Extension;
7
8
use JaySDe\HandlebarsBundle\HandlebarsEngine;
9
10
class HandlebarsTwigExtension extends \Twig_Extension
11
{
12
    private $engine;
13
14 1
    public function __construct(HandlebarsEngine $environment)
15
    {
16 1
        $this->engine = $environment;
17
18 1
    }
19 1
    public function getFunctions()
20
    {
21
        return [
22 1
            new \Twig_SimpleFunction('render_hbs', [$this, 'renderHandlebars'])
23
        ];
24
    }
25
26 1
    public function renderHandlebars($name, array $data = [])
27
    {
28 1
        return $this->engine->render($name, $data);
29
    }
30
31
    public function getName()
32
    {
33
        return 'HandlebarsTwigExtension';
34
    }
35
}
36