Completed
Push — develop ( eacff6...fbb474 )
by Andrea
15:51
created

UtilitaExtension::getParametroTabella()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Cdf\BiCoreBundle\Twig\Extension;
4
5
use Cdf\BiCoreBundle\Utils\Tabella\ParametriTabella;
6
7
class UtilitaExtension extends \Twig_Extension
8
{
9
    public $container;
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function getFunctions()
14
    {
15
        return array(
16
            new \Twig_SimpleFunction('json_decode', array($this, 'jsonDecode', 'is_safe' => array('html'))),
17
            new \Twig_SimpleFunction('parameter', array($this, 'getParameter', 'is_safe' => array('html'))),
18
        );
19
    }
20
    
21
    public function getFilters()
22
    {
23
        return array(
24
            new \Twig_SimpleFilter('getparametrotabella', array($this, 'getParametroTabella')),
25
        );
26
    }
27
28 7
    public function jsonDecode($string)
29
    {
30 7
        return json_decode($string);
31
    }
32 11
    public function getParameter($parameter)
33
    {
34 11
        return  $this->container->getParameter($parameter);
35
    }
36 11
    public function getParametroTabella($parametro)
37
    {
38 11
        return ParametriTabella::getParameter($parametro);
39
    }
40
}
41