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

EventsOutput   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A draw() 0 11 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