mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 03:58:45 +02:00
N°2435.1 Portal: Split portal composer.json in 2
- Autoloader for portal files in the itop-portal-base module - Dependencies moved to root composer.json - Add autoloader for /core and /application content
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
|
||||
abstract class AbstractServiceConfigurator extends AbstractConfigurator
|
||||
{
|
||||
protected $parent;
|
||||
protected $id;
|
||||
private $defaultTags = [];
|
||||
|
||||
public function __construct(ServicesConfigurator $parent, Definition $definition, $id = null, array $defaultTags = [])
|
||||
{
|
||||
$this->parent = $parent;
|
||||
$this->definition = $definition;
|
||||
$this->id = $id;
|
||||
$this->defaultTags = $defaultTags;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
// default tags should be added last
|
||||
foreach ($this->defaultTags as $name => $attributes) {
|
||||
foreach ($attributes as $attributes) {
|
||||
$this->definition->addTag($name, $attributes);
|
||||
}
|
||||
}
|
||||
$this->defaultTags = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a service.
|
||||
*
|
||||
* @param string $id
|
||||
* @param string|null $class
|
||||
*
|
||||
* @return ServiceConfigurator
|
||||
*/
|
||||
final public function set($id, $class = null)
|
||||
{
|
||||
$this->__destruct();
|
||||
|
||||
return $this->parent->set($id, $class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an alias.
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $referencedId
|
||||
*
|
||||
* @return AliasConfigurator
|
||||
*/
|
||||
final public function alias($id, $referencedId)
|
||||
{
|
||||
$this->__destruct();
|
||||
|
||||
return $this->parent->alias($id, $referencedId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a PSR-4 namespace using a glob pattern.
|
||||
*
|
||||
* @param string $namespace
|
||||
* @param string $resource
|
||||
*
|
||||
* @return PrototypeConfigurator
|
||||
*/
|
||||
final public function load($namespace, $resource)
|
||||
{
|
||||
$this->__destruct();
|
||||
|
||||
return $this->parent->load($namespace, $resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an already defined service definition.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return ServiceConfigurator
|
||||
*
|
||||
* @throws ServiceNotFoundException if the service definition does not exist
|
||||
*/
|
||||
final public function get($id)
|
||||
{
|
||||
$this->__destruct();
|
||||
|
||||
return $this->parent->get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a service.
|
||||
*
|
||||
* @param string $id
|
||||
* @param string|null $class
|
||||
*
|
||||
* @return ServiceConfigurator
|
||||
*/
|
||||
final public function __invoke($id, $class = null)
|
||||
{
|
||||
$this->__destruct();
|
||||
|
||||
return $this->parent->set($id, $class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user