HandlebarsTwigExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 26
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getFunctions() 0 6 1
A renderHandlebars() 0 4 1
A getName() 0 4 1
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
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Extension has been deprecated with message: since Twig 2.7, use "Twig\Extension\AbstractExtension" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
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'])
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFunction has been deprecated with message: since Twig 2.7, use "Twig\TwigFunction" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
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