C3Extension::c3chart()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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