Passed
Pull Request — master (#38)
by Christophe
05:14
created

EventsOutput   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 15
ccs 4
cts 6
cp 0.6667
rs 10
c 1
b 0
f 0
wmc 2

1 Method

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