VersioneExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 21
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A versioneTagGit() 0 5 1
A getFunctions() 0 4 1
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