Completed
Push — develop ( c9e3d9...18aa16 )
by Andrea
15:20
created

UtilitaExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 21
ccs 4
cts 7
cp 0.5714
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonDecode() 0 3 1
A getParameter() 0 3 1
A getFunctions() 0 5 1
1
<?php
2
3
namespace Cdf\BiCoreBundle\Twig\Extension;
4
5
class UtilitaExtension extends \Twig_Extension
6
{
7
    public $container;
8
    /**
9
     * {@inheritdoc}
10
     */
11
    public function getFunctions()
12
    {
13
        return array(
14
            new \Twig_SimpleFunction('json_decode', array($this, 'jsonDecode', 'is_safe' => array('html'))),
15
            new \Twig_SimpleFunction('parameter', array($this, 'getParameter', 'is_safe' => array('html'))),
16
        );
17
    }
18
    
19 7
    public function jsonDecode($string)
20
    {
21 7
        return json_decode($string);
22
    }
23 10
    public function getParameter($parameter)
24
    {
25 10
        return  $this->container->getParameter($parameter);
26
    }
27
}
28