Drop the service container class.

This commit is contained in:
David Molineus
2016-10-05 08:52:46 +02:00
parent f4a54cdec3
commit 13253873fa
5 changed files with 61 additions and 84 deletions

View File

@@ -0,0 +1,28 @@
<?php
/**
* @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2016 netzmacht David Molineus. All rights reserved.
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\DependencyInjection;
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
/**
* Class LeafletServices describes services provided by the leaflet package.
*
* @package Netzmacht\Contao\Leaflet\DependencyInjection
*/
class LeafletServices
{
/**
* Service name of the frontend value filter.
*
* @return ValueFilter
*/
const FRONTEND_VALUE_FILTER = 'leaflet.frontend.value-filter';
}

View File

@@ -1,61 +0,0 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet;
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
/**
* Class ServiceContainer provides the services which are available for Contao leaflet.
*
* @package Netzmacht\Contao\Leaflet
*/
class ServiceContainer
{
/**
* The global service container.
*
* @var \Pimple
*/
private $container;
/**
* Construct.
*
* @param \Pimple $container The global service container.
*/
public function __construct(\Pimple $container)
{
$this->container = $container;
}
/**
* Get the value filter service.
*
* @return ValueFilter
*/
public function getFrontendValueFilter()
{
return $this->getService('leaflet.frontend.value-filter');
}
/**
* Get a service from the container.
*
* @param string $name The service name.
*
* @return mixed
*/
public function getService($name)
{
return $this->container[$name];
}
}

View File

@@ -209,7 +209,7 @@ class BootSubscriber implements EventSubscriberInterface
private function createMapper($mapper)
{
if (is_callable($mapper)) {
$container = $GLOBALS['container']['leaflet.service-container'];
$container = $GLOBALS['container'][Services::CONTAINER];
return $mapper($container);
}