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::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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