Completed
Push — master ( d9bece...2ea354 )
by Andrea
10:06
created

UtilitaExtension::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Fi\CoreBundle\Twig\Extension;
4
5
use Fi\CoreBundle\Controller\fiUtilita;
6
7
class UtilitaExtension extends \Twig_Extension
8
{
9
    protected $loader;
10
    protected $controller;
11
12 17
    public function __construct(\Twig_LoaderInterface $loader)
13
    {
14 17
        $this->loader = $loader;
15 17
    }
16
17
    public function setController($controller)
18
    {
19
        $this->controller = $controller;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 10
    public function getFunctions()
26
    {
27
        return array(
28 10
            new \Twig_SimpleFunction('db2data', array($this, 'getDb2data', 'is_safe' => array('html'))),
29 10
        );
30
    }
31
32
    public function getDb2data($giorno)
33
    {
34
        // highlight_string highlights php code only if '<?php' tag is present.
35
36
        return fiUtilita::db2data($giorno, true);
37
    }
38
}
39