Total Complexity | 6 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 85.71% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | class StaticMapExtension extends AbstractExtension |
||
22 | { |
||
23 | /** @var StaticMapHelper */ |
||
24 | private $staticMapHelper; |
||
25 | |||
26 | 1 | public function __construct(StaticMapHelper $staticMapHelper) |
|
27 | { |
||
28 | 1 | $this->staticMapHelper = $staticMapHelper; |
|
29 | 1 | } |
|
30 | |||
31 | /** {@inheritdoc} */ |
||
32 | 1 | public function getFunctions(): array |
|
33 | { |
||
34 | 1 | $functions = []; |
|
35 | |||
36 | 1 | foreach ($this->getMapping() as $name => $method) { |
|
37 | 1 | $functions[] = new TwigFunction($name, [$this, $method], ['is_safe' => ['html']]); |
|
38 | } |
||
39 | |||
40 | 1 | return $functions; |
|
41 | } |
||
42 | |||
43 | 1 | public function render(Map $map): string |
|
44 | { |
||
45 | 1 | return $this->staticMapHelper->render($map); |
|
46 | } |
||
47 | |||
48 | public function getName(): string |
||
49 | { |
||
50 | return 'ivory_google_map_static'; |
||
51 | } |
||
52 | |||
53 | 1 | private function getMapping(): array |
|
56 | } |
||
57 | } |
||
58 |