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 — static-map ( 1bc0cf )
by Eric
64:02
created

MarkerStyleRenderer   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 3
dl 0
loc 43
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
C render() 0 22 9
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\Renderer\Image\Overlay;
13
14
use Ivory\GoogleMap\Base\Point;
15
use Ivory\GoogleMap\Helper\Renderer\Image\Base\PointRenderer;
16
use Ivory\GoogleMap\Overlay\Icon;
17
use Ivory\GoogleMap\Overlay\Marker;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22
class MarkerStyleRenderer extends AbstractStyleRenderer
23
{
24
    /**
25
     * @var PointRenderer
26
     */
27
    private $pointRenderer;
28
29
    /**
30
     * @param PointRenderer $pointRenderer
31
     */
32
    public function __construct(PointRenderer $pointRenderer)
33
    {
34
        $this->pointRenderer = $pointRenderer;
35
    }
36
37
    /**
38
     * @param Marker $marker
39
     *
40
     * @return string
41
     */
42
    public function render(Marker $marker)
43
    {
44
        $options = $marker->hasStaticOption('styles') ? $marker->getStaticOption('styles') : [];
45
46
        if ($marker->hasIcon()) {
47
            $icon = $marker->getIcon();
48
49
            if (!isset($options['icon']) && ($url = $icon->getUrl()) !== Icon::DEFAULT_URL) {
50
                $options['icon'] = $url;
51
            }
52
53
            if (!isset($options['anchor']) && $icon->hasAnchor()) {
54
                $options['anchor'] = $icon->getAnchor();
55
            }
56
        }
57
58
        if (isset($options['anchor']) && $options['anchor'] instanceof Point) {
59
            $options['anchor'] = $this->pointRenderer->render($options['anchor']);
60
        }
61
62
        return $this->renderStyle($options);
63
    }
64
}
65