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.

ExtendableSubscriber::getExtendableRenderer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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\Overlay;
13
14
use Ivory\GoogleMap\Helper\Collector\Overlay\ExtendableCollector;
15
use Ivory\GoogleMap\Helper\Event\MapEvent;
16
use Ivory\GoogleMap\Helper\Event\MapEvents;
17
use Ivory\GoogleMap\Helper\Formatter\Formatter;
18
use Ivory\GoogleMap\Helper\Renderer\Overlay\Extendable\ExtendableRenderer;
19
use Ivory\GoogleMap\Helper\Subscriber\AbstractSubscriber;
20
21
/**
22
 * @author GeLo <[email protected]>
23
 */
24 View Code Duplication
class ExtendableSubscriber extends AbstractSubscriber
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
{
26
    /**
27
     * @var ExtendableCollector
28
     */
29
    private $extendableCollector;
30
31
    /**
32
     * @var ExtendableRenderer
33
     */
34
    private $extendableRenderer;
35
36
    /**
37
     * @param Formatter           $formatter
38
     * @param ExtendableCollector $extendableCollector
39
     * @param ExtendableRenderer  $extendableRenderer
40
     */
41 220
    public function __construct(
42
        Formatter $formatter,
43
        ExtendableCollector $extendableCollector,
44
        ExtendableRenderer $extendableRenderer
45
    ) {
46 220
        parent::__construct($formatter);
47
48 220
        $this->setExtendableCollector($extendableCollector);
49 220
        $this->setExtendableRenderer($extendableRenderer);
50 220
    }
51
52
    /**
53
     * @return ExtendableCollector
54
     */
55
    public function getExtendableCollector()
56
    {
57
        return $this->extendableCollector;
58
    }
59
60
    /**
61
     * @param ExtendableCollector $extendableCollector
62
     */
63 220
    public function setExtendableCollector(ExtendableCollector $extendableCollector)
64
    {
65 220
        $this->extendableCollector = $extendableCollector;
66 220
    }
67
68
    /**
69
     * @return ExtendableRenderer
70
     */
71
    public function getExtendableRenderer()
72
    {
73
        return $this->extendableRenderer;
74
    }
75
76
    /**
77
     * @param ExtendableRenderer $extendableRenderer
78
     */
79 220
    public function setExtendableRenderer(ExtendableRenderer $extendableRenderer)
80
    {
81 220
        $this->extendableRenderer = $extendableRenderer;
82 220
    }
83
84
    /**
85
     * @param MapEvent $event
86
     */
87 216
    public function handleMap(MapEvent $event)
88
    {
89 216
        $formatter = $this->getFormatter();
90 216
        $map = $event->getMap();
91
92 216
        foreach ($this->extendableCollector->collect($map) as $extendable) {
93 56
            $event->addCode($formatter->renderCode($this->extendableRenderer->render($extendable, $map->getBound())));
94 108
        }
95 216
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100 220
    public static function getSubscribedEvents()
101
    {
102 220
        return [MapEvents::JAVASCRIPT_FINISH => 'handleMap'];
103
    }
104
}
105