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

UtilitaExtension::getFunctions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
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