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.

StaticMapExtension::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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\StaticMapHelper;
15
use Ivory\GoogleMap\Map;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20 View Code Duplication
class StaticMapExtension extends \Twig_Extension
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...
21
{
22
    /**
23
     * @var StaticMapHelper
24
     */
25
    private $staticMapHelper;
26
27
    /**
28
     * @param StaticMapHelper $staticMapHelper
29
     */
30 9
    public function __construct(StaticMapHelper $staticMapHelper)
31
    {
32 9
        $this->staticMapHelper = $staticMapHelper;
33 9
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 9
    public function getFunctions()
39
    {
40 9
        $functions = [];
41
42 9
        foreach ($this->getMapping() as $name => $method) {
43 9
            $functions[] = new \Twig_SimpleFunction($name, [$this, $method], ['is_safe' => ['html']]);
44 7
        }
45
46 9
        return $functions;
47
    }
48
49
    /**
50
     * @param Map $map
51
     *
52
     * @return string
53
     */
54 9
    public function render(Map $map)
55
    {
56 9
        return $this->staticMapHelper->render($map);
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 9
    public function getName()
63
    {
64 9
        return 'ivory_google_map_static';
65
    }
66
67
    /**
68
     * @return string[]
69
     */
70 9
    private function getMapping()
71
    {
72 9
        return ['ivory_google_map_static' => 'render'];
73
    }
74
}
75