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

UtilitaExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 54.55%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 32
ccs 6
cts 11
cp 0.5455
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setController() 0 4 1
A getDb2data() 0 6 1
A getFunctions() 0 6 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