Code Duplication    Length = 28-28 lines in 2 locations

src/Helper/Subscriber/Image/TypeSubscriber.php 1 location

@@ 21-48 (lines=28) @@
18
/**
19
 * @author GeLo <[email protected]>
20
 */
21
class TypeSubscriber implements EventSubscriberInterface
22
{
23
    public function handleMap(StaticMapEvent $event)
24
    {
25
        $map = $event->getMap();
26
27
        if ($map->hasStaticOption('maptype')) {
28
            $type = $map->getStaticOption('maptype');
29
        } elseif ($map->hasMapOption('mapTypeId')) {
30
            $type = $map->getMapOption('mapTypeId');
31
        }
32
33
        if (isset($type)) {
34
            $event->setParameter('maptype', strtolower($type));
35
        }
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public static function getSubscribedEvents()
42
    {
43
        return [StaticMapEvents::TYPE => 'handleMap'];
44
    }
45
}
46

src/Helper/Subscriber/Image/ZoomSubscriber.php 1 location

@@ 21-48 (lines=28) @@
18
/**
19
 * @author GeLo <[email protected]>
20
 */
21
class ZoomSubscriber implements EventSubscriberInterface
22
{
23
    public function handleMap(StaticMapEvent $event)
24
    {
25
        $map = $event->getMap();
26
27
        if ($map->hasMapOption('zoom')) {
28
            $zoom = $map->getMapOption('zoom');
29
        } elseif (!$map->isAutoZoom()) {
30
            $zoom = 3;
31
        }
32
33
        if (isset($zoom)) {
34
            $event->setParameter('zoom', $zoom);
35
        }
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public static function getSubscribedEvents()
42
    {
43
        return [StaticMapEvents::ZOOM => 'handleMap'];
44
    }
45
}
46