Passed
Pull Request — master (#38)
by Christophe
02:59
created

EventsOutput   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 17
ccs 4
cts 6
cp 0.6667
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 4
    public function draw(Events $events, $chartName)
14
    {
15 4
        $js = '';
16
17 4
        foreach ($events->getListeners() as $listener) {
18
            $js .= 'google.visualization.events.addListener('.$chartName.", '".$listener->getType().
19
                "', ".$listener->getFunction().');';
20
        }
21
22 4
        return $js;
23
    }
24
}
25