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

UtilitaExtension::getParameter()   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
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