C3Extension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 29
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 6 1
A c3chart() 0 4 1
A getName() 0 4 1
1
<?php
2
3
namespace Muspelheim\C3ChartsBundle\Twig;
4
5
use Muspelheim\C3ChartsBundle\C3\ChartInterface;
6
7
/**
8
 * Class C3Extension
9
 * @package Muspelheim\C3ChartsBundle\Twig
10
 */
11
class C3Extension extends \Twig_Extension
12
{
13
    /**
14
     * @return array|
15
     */
16
    public function getFunctions()
17
    {
18
        return [
19
            new \Twig_SimpleFunction('c3chart', [$this, 'c3chart'], ['is_safe' => ['html']]),
20
        ];
21
    }
22
23
    /**
24
     * @param ChartInterface $chart
25
     * @return string
26
     */
27
    public function c3chart(ChartInterface $chart)
28
    {
29
        return $chart->render();
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function getName()
36
    {
37
        return 'c3_extension';
38
    }
39
}
40