Test Failed
Push — master ( d818fc...2d2f9a )
by Christophe
08:50
created

EventsOutput::draw()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 2
1
<?php
2
3
namespace CMEN\GoogleChartsBundle\Output\Javascript;
4
5
use CMEN\GoogleChartsBundle\GoogleCharts\Events;
6
use CMEN\GoogleChartsBundle\Output\EventsOutputInterface;
7
8
class EventsOutput implements EventsOutputInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function draw(Events $events, $chartName)
14
    {
15
        $js = '';
16
17
        foreach ($events->getListeners() as $listener) {
18
            $js .= 'google.visualization.events.addListener('.$chartName.", '".$listener->getType().
19
                "', ".$listener->getFunction().');';
20
        }
21
22
        return $js;
23
    }
24
}
25