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.

MarkerStyleRenderer::render()   C
last analyzed

Complexity

Conditions 9
Paths 20

Size

Total Lines 22
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 9

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 15
cts 15
cp 1
rs 6.412
c 0
b 0
f 0
cc 9
eloc 11
nc 20
nop 1
crap 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 128
    public function __construct(PointRenderer $pointRenderer)
33
    {
34 128
        $this->pointRenderer = $pointRenderer;
35 128
    }
36
37
    /**
38
     * @param Marker $marker
39
     *
40
     * @return string
41
     */
42 40
    public function render(Marker $marker)
43
    {
44 40
        $options = $marker->hasStaticOption('styles') ? $marker->getStaticOption('styles') : [];
45
46 40
        if ($marker->hasIcon()) {
47 8
            $icon = $marker->getIcon();
48
49 8
            if (!isset($options['icon']) && ($url = $icon->getUrl()) !== Icon::DEFAULT_URL) {
50 8
                $options['icon'] = $url;
51 4
            }
52
53 8
            if (!isset($options['anchor']) && $icon->hasAnchor()) {
54 8
                $options['anchor'] = $icon->getAnchor();
55 4
            }
56 4
        }
57
58 40
        if (isset($options['anchor']) && $options['anchor'] instanceof Point) {
59 8
            $options['anchor'] = $this->pointRenderer->render($options['anchor']);
60 4
        }
61
62 40
        return $this->renderStyle($options);
63
    }
64
}
65