From abcc4f5d885fad1e4eb743759ac0f917b434ce15 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Wed, 5 Oct 2016 14:18:15 +0200 Subject: [PATCH] Rename MapService to MapProvider --- module/config/services.php | 12 +++++----- .../Leaflet/Frontend/AbstractMapHybrid.php | 22 +++++++++---------- .../Leaflet/Frontend/DataController.php | 20 ++++++++--------- .../InsertTag/LeafletInsertTagParser.php | 18 +++++++-------- .../{MapService.php => MapProvider.php} | 4 ++-- .../Leaflet/Subscriber/BootSubscriber.php | 8 +++---- 6 files changed, 42 insertions(+), 42 deletions(-) rename src/Netzmacht/Contao/Leaflet/{MapService.php => MapProvider.php} (99%) diff --git a/module/config/services.php b/module/config/services.php index 3d8d23f..ac1f32f 100644 --- a/module/config/services.php +++ b/module/config/services.php @@ -17,7 +17,7 @@ use Netzmacht\Contao\Leaflet\Frontend\MapElement; use Netzmacht\Contao\Leaflet\Frontend\MapModule; use Netzmacht\Contao\Leaflet\Frontend\ValueFilter; use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; -use Netzmacht\Contao\Leaflet\MapService; +use Netzmacht\Contao\Leaflet\MapProvider; use Netzmacht\Contao\Toolkit\Data\Alias\Filter\ExistingAliasFilter; use Netzmacht\Contao\Toolkit\Data\Alias\Filter\SlugifyFilter; use Netzmacht\Contao\Toolkit\Data\Alias\Filter\SuffixFilter; @@ -38,10 +38,10 @@ use Symfony\Component\EventDispatcher\EventDispatcher; global $container; /* - * Leaflet map service is a simply api entry to to get the leaflet map from the database. + * Leaflet map provider is a simply api entry to to get the leaflet map from the database. */ -$container['leaflet.map.service'] = $container->share(function ($container) { - return new MapService( +$container['leaflet.map.provider'] = $container->share(function ($container) { + return new MapProvider( $container['leaflet.definition.mapper'], $container['leaflet.definition.builder'], $container['event-dispatcher'], @@ -183,7 +183,7 @@ $container[Services::CONTENT_ELEMENTS_MAP]['leaflet'] = function ($model, $colum $model, $container->get(Services::TEMPLATE_FACTORY), $container->get(Services::TRANSLATOR), - $container->get('leaflet.map.service'), + $container->get('leaflet.map.provider'), $container->get(Services::INPUT), $container->get(Services::CONFIG), $column @@ -195,7 +195,7 @@ $container[Services::MODULES_MAP]['leaflet'] = function ($model, $column, Contai $model, $container->get(Services::TEMPLATE_FACTORY), $container->get(Services::TRANSLATOR), - $container->get('leaflet.map.service'), + $container->get('leaflet.map.provider'), $container->get(Services::INPUT), $container->get(Services::CONFIG), $column diff --git a/src/Netzmacht/Contao/Leaflet/Frontend/AbstractMapHybrid.php b/src/Netzmacht/Contao/Leaflet/Frontend/AbstractMapHybrid.php index ff6ac90..f616c55 100644 --- a/src/Netzmacht/Contao/Leaflet/Frontend/AbstractMapHybrid.php +++ b/src/Netzmacht/Contao/Leaflet/Frontend/AbstractMapHybrid.php @@ -14,7 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Frontend; use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator; use Database\Result; use Model\Collection; -use Netzmacht\Contao\Leaflet\MapService; +use Netzmacht\Contao\Leaflet\MapProvider; use Netzmacht\Contao\Leaflet\Model\MapModel; use Netzmacht\Contao\Toolkit\Component\Hybrid\AbstractHybrid; use Netzmacht\Contao\Toolkit\View\Template\TemplateFactory; @@ -27,11 +27,11 @@ use Netzmacht\Contao\Toolkit\View\Template\TemplateFactory; abstract class AbstractMapHybrid extends AbstractHybrid { /** - * The map service. + * The map provider. * - * @var MapService + * @var MapProvider */ - private $mapService; + private $mapProvider; /** * The user input. @@ -53,7 +53,7 @@ abstract class AbstractMapHybrid extends AbstractHybrid * @param Result|\Model|Collection $model Component model. * @param TemplateFactory $templateFactory Template factory. * @param Translator $translator Translator. - * @param MapService $mapService Map service. + * @param MapProvider $mapProvider Map provider. * @param \Input $input Input * @param \Config $config Config. * @param string $column Column in which the element appears. @@ -62,16 +62,16 @@ abstract class AbstractMapHybrid extends AbstractHybrid $model, TemplateFactory $templateFactory, Translator $translator, - MapService $mapService, + MapProvider $mapProvider, \Input $input, \Config $config, $column = null ) { parent::__construct($model, $templateFactory, $translator, $column); - $this->mapService = $mapService; - $this->input = $input; - $this->config = $config; + $this->mapProvider = $mapProvider; + $this->input = $input; + $this->config = $config; } /** @@ -81,7 +81,7 @@ abstract class AbstractMapHybrid extends AbstractHybrid */ public function generate() { - $this->mapService->handleAjaxRequest($this->getIdentifier()); + $this->mapProvider->handleAjaxRequest($this->getIdentifier()); if (TL_MODE === 'BE') { $model = MapModel::findByPk($this->get('leaflet_map')); @@ -118,7 +118,7 @@ abstract class AbstractMapHybrid extends AbstractHybrid try { $template = $this->get('leaflet_template') ?: 'leaflet_map_js'; $mapId = $this->getIdentifier(); - $map = $this->mapService->generate($this->get('leaflet_map'), null, $mapId, $template); + $map = $this->mapProvider->generate($this->get('leaflet_map'), null, $mapId, $template); $GLOBALS['TL_BODY'][] = ''; diff --git a/src/Netzmacht/Contao/Leaflet/Frontend/DataController.php b/src/Netzmacht/Contao/Leaflet/Frontend/DataController.php index 1b9d67b..eefbfbf 100644 --- a/src/Netzmacht/Contao/Leaflet/Frontend/DataController.php +++ b/src/Netzmacht/Contao/Leaflet/Frontend/DataController.php @@ -12,7 +12,7 @@ namespace Netzmacht\Contao\Leaflet\Frontend; use Netzmacht\Contao\Leaflet\Filter\Filter; -use Netzmacht\Contao\Leaflet\MapService; +use Netzmacht\Contao\Leaflet\MapProvider; /** * The data controller handles ajax request for sub data. @@ -22,11 +22,11 @@ use Netzmacht\Contao\Leaflet\MapService; class DataController { /** - * The map service. + * The map provider. * - * @var MapService + * @var MapProvider */ - private $mapService; + private $mapProvider; /** * The user input data. @@ -44,13 +44,13 @@ class DataController /** * Construct. * - * @param MapService $mapService The map service. - * @param array $input The user input as array. + * @param MapProvider $mapProvider The map provider. + * @param array $input The user input as array. */ - public function __construct(MapService $mapService, $input) + public function __construct(MapProvider $mapProvider, $input) { - $this->mapService = $mapService; - $this->input = array_merge($this->input, $input); + $this->mapProvider = $mapProvider; + $this->input = array_merge($this->input, $input); } /** @@ -120,7 +120,7 @@ class DataController switch ($type) { case 'layer': - $data = $this->mapService->getFeatureCollection($dataId, $filter); + $data = $this->mapProvider->getFeatureCollection($dataId, $filter); break; default: diff --git a/src/Netzmacht/Contao/Leaflet/Frontend/InsertTag/LeafletInsertTagParser.php b/src/Netzmacht/Contao/Leaflet/Frontend/InsertTag/LeafletInsertTagParser.php index 61f140f..8448e00 100644 --- a/src/Netzmacht/Contao/Leaflet/Frontend/InsertTag/LeafletInsertTagParser.php +++ b/src/Netzmacht/Contao/Leaflet/Frontend/InsertTag/LeafletInsertTagParser.php @@ -11,7 +11,7 @@ namespace Netzmacht\Contao\Leaflet\Frontend\InsertTag; -use Netzmacht\Contao\Leaflet\MapService; +use Netzmacht\Contao\Leaflet\MapProvider; use Netzmacht\Contao\Toolkit\InsertTag\Parser; /** @@ -31,9 +31,9 @@ class LeafletInsertTagParser implements Parser /** * The map service. * - * @var MapService + * @var MapProvider */ - private $mapService; + private $mapProvider; /** * Debug mode. @@ -45,13 +45,13 @@ class LeafletInsertTagParser implements Parser /** * LeafletInsertTagParser constructor. * - * @param MapService $mapService Map service. - * @param bool $debugMode Debug mode. + * @param MapProvider $mapProvider Map provider. + * @param bool $debugMode Debug mode. */ - public function __construct(MapService $mapService, $debugMode) + public function __construct(MapProvider $mapProvider, $debugMode) { - $this->mapService = $mapService; - $this->debugMode = $debugMode; + $this->mapProvider = $mapProvider; + $this->debugMode = $debugMode; } /** @@ -101,7 +101,7 @@ class LeafletInsertTagParser implements Parser private function generateMap($mapId, $template, $style) { try { - return $this->mapService->generate($mapId, null, $mapId, $template, $style); + return $this->mapProvider->generate($mapId, null, $mapId, $template, $style); } catch (\Exception $e) { if ($this->debugMode) { throw $e; diff --git a/src/Netzmacht/Contao/Leaflet/MapService.php b/src/Netzmacht/Contao/Leaflet/MapProvider.php similarity index 99% rename from src/Netzmacht/Contao/Leaflet/MapService.php rename to src/Netzmacht/Contao/Leaflet/MapProvider.php index e82d535..767c5d6 100644 --- a/src/Netzmacht/Contao/Leaflet/MapService.php +++ b/src/Netzmacht/Contao/Leaflet/MapProvider.php @@ -25,11 +25,11 @@ use Netzmacht\LeafletPHP\Leaflet; use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher; /** - * Class MapService. + * Class MapProvider. * * @package Netzmacht\Contao\Leaflet */ -class MapService +class MapProvider { /** * The definition mapper. diff --git a/src/Netzmacht/Contao/Leaflet/Subscriber/BootSubscriber.php b/src/Netzmacht/Contao/Leaflet/Subscriber/BootSubscriber.php index 5809db0..34ef4dc 100644 --- a/src/Netzmacht/Contao/Leaflet/Subscriber/BootSubscriber.php +++ b/src/Netzmacht/Contao/Leaflet/Subscriber/BootSubscriber.php @@ -56,10 +56,10 @@ class BootSubscriber implements EventSubscriberInterface */ public function initializeInsertTagParser(InitializeSystemEvent $event) { - $container = $event->getContainer(); - $debugMode = $container->get(Services::CONFIG)->get('debugMode'); - $mapService = $container->get('leaflet.map.service'); - $parser = new LeafletInsertTagParser($mapService, $debugMode); + $container = $event->getContainer(); + $debugMode = $container->get(Services::CONFIG)->get('debugMode'); + $mapProvider = $container->get('leaflet.map.provider'); + $parser = new LeafletInsertTagParser($mapProvider, $debugMode); $container->get(Services::INSERT_TAG_REPLACER)->registerParser($parser); }