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.

MapExtension   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 4
dl 0
loc 96
ccs 27
cts 27
cp 1
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A render() 0 6 1
A renderHtml() 0 6 1
A renderStylesheet() 0 4 1
A renderJavascript() 0 4 1
A getName() 0 4 1
A getMapping() 0 9 1
A getFunctions() 0 10 2
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map bundle 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\GoogleMapBundle\Twig;
13
14
use Ivory\GoogleMap\Helper\MapHelper;
15
use Ivory\GoogleMap\Map;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class MapExtension extends \Twig_Extension
21
{
22
    /**
23
     * @var MapHelper
24
     */
25
    private $mapHelper;
26
27
    /**
28
     * @param MapHelper $mapHelper
29
     */
30 36
    public function __construct(MapHelper $mapHelper)
31
    {
32 36
        $this->mapHelper = $mapHelper;
33 36
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 36
    public function getFunctions()
39
    {
40 36
        $functions = [];
41
42 36
        foreach ($this->getMapping() as $name => $method) {
43 36
            $functions[] = new \Twig_SimpleFunction($name, [$this, $method], ['is_safe' => ['html']]);
44 28
        }
45
46 36
        return $functions;
47
    }
48
49
    /**
50
     * @param Map      $map
51
     * @param string[] $attributes
52
     *
53
     * @return string
54
     */
55 9
    public function render(Map $map, array $attributes = [])
56
    {
57 9
        $map->addHtmlAttributes($attributes);
58
59 9
        return $this->mapHelper->render($map);
60
    }
61
62
    /**
63
     * @param Map      $map
64
     * @param string[] $attributes
65
     *
66
     * @return string
67
     */
68 9
    public function renderHtml(Map $map, array $attributes = [])
69
    {
70 9
        $map->addHtmlAttributes($attributes);
71
72 9
        return $this->mapHelper->renderHtml($map);
73
    }
74
75
    /**
76
     * @param Map $map
77
     *
78
     * @return string
79
     */
80 9
    public function renderStylesheet(Map $map)
81
    {
82 9
        return $this->mapHelper->renderStylesheet($map);
83
    }
84
85
    /**
86
     * @param Map $map
87
     *
88
     * @return string
89
     */
90 9
    public function renderJavascript(Map $map)
91
    {
92 9
        return $this->mapHelper->renderJavascript($map);
93
    }
94
95
    /**
96
     * {@inheritdoc}
97
     */
98 36
    public function getName()
99
    {
100 36
        return 'ivory_google_map';
101
    }
102
103
    /**
104
     * @return string[]
105
     */
106 36
    private function getMapping()
107
    {
108
        return [
109 36
            'ivory_google_map'           => 'render',
110 28
            'ivory_google_map_container' => 'renderHtml',
111 28
            'ivory_google_map_css'       => 'renderStylesheet',
112 28
            'ivory_google_map_js'        => 'renderJavascript',
113 28
        ];
114
    }
115
}
116