VersioneExtension::getFunctions()   A
last analyzed

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
eloc 2
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Fi\CoreBundle\Twig\Extension;
4
5
use Fi\CoreBundle\Controller\FiVersioneController;
6
use Symfony\Component\DependencyInjection\ContainerInterface;
7
use Twig_Extension;
8
use Twig_SimpleFunction;
9
10
class VersioneExtension extends Twig_Extension
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Extension has been deprecated: since Twig 2.7, use "Twig\Extension\AbstractExtension" instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

10
class VersioneExtension extends /** @scrutinizer ignore-deprecated */ Twig_Extension
Loading history...
11
{
12
    protected $container;
13
14 35
    public function __construct(ContainerInterface $container)
15
    {
16 35
        $this->container = $container;
17 35
    }
18
19
    public function getFunctions()
20
    {
21
        return array(
22
            new Twig_SimpleFunction('versione_tag_git', array($this, 'versioneTagGit', 'is_safe' => array('html'))),
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFunction has been deprecated: since Twig 2.7, use "Twig\TwigFunction" instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

22
            /** @scrutinizer ignore-deprecated */ new Twig_SimpleFunction('versione_tag_git', array($this, 'versioneTagGit', 'is_safe' => array('html'))),
Loading history...
23
        );
24
    }
25
26 13
    public function versioneTagGit()
27
    {
28 13
        FiVersioneController::versione($this->container);
29
30 13
        return FiVersioneController::$versione;
31
    }
32
}
33