GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 89c9d5...c16126 )
by Eric
109:24 queued 106:15
created

StyleSubscriber   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 52.94%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 3
dl 0
loc 45
ccs 9
cts 17
cp 0.5294
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handleMap() 0 18 4
A getSubscribedEvents() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMap\Helper\Subscriber\Image;
13
14
use Ivory\GoogleMap\Helper\Event\StaticMapEvent;
15
use Ivory\GoogleMap\Helper\Event\StaticMapEvents;
16
use Ivory\GoogleMap\Helper\Renderer\Image\StyleRenderer;
17
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22
class StyleSubscriber implements EventSubscriberInterface
23
{
24
    /**
25
     * @var StyleRenderer
26
     */
27
    private $styleRenderer;
28
29
    /**
30
     * @param StyleRenderer $styleRenderer
31
     */
32 104
    public function __construct(StyleRenderer $styleRenderer)
33
    {
34 104
        $this->styleRenderer = $styleRenderer;
35 104
    }
36
37
    /**
38
     * @param StaticMapEvent $event
39
     */
40 100
    public function handleMap(StaticMapEvent $event)
41
    {
42 100
        $map = $event->getMap();
43
44 100
        if (!$map->hasMapOption('styles')) {
45 100
            return;
46
        }
47
48
        $styles = [];
49
50
        foreach ($map->getStaticOption('styles') as $style) {
51
            $styles[] = $this->styleRenderer->render($style);
52
        }
53
54
        if (!empty($styles)) {
55
            $event->setParameter('style', $styles);
56
        }
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 104
    public static function getSubscribedEvents()
63
    {
64 104
        return [StaticMapEvents::STYLE => 'handleMap'];
65
    }
66
}
67