This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php

36 lines
957 B
PHP
Raw Normal View History

2011-01-26 23:14:31 +00:00
<?php
2011-05-31 09:57:06 +01:00
/*
2012-03-31 22:00:32 +01:00
* This file is part of the Symfony package.
2011-05-31 09:57:06 +01:00
*
* (c) Fabien Potencier <fabien@symfony.com>
*
2012-03-31 22:00:32 +01:00
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
2011-05-31 09:57:06 +01:00
*/
2011-01-26 23:14:31 +00:00
namespace Symfony\Component\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
2011-02-13 18:06:41 +00:00
/**
2014-12-21 17:00:50 +00:00
* Removes abstract Definitions.
2011-02-13 18:06:41 +00:00
*/
2011-01-26 23:14:31 +00:00
class RemoveAbstractDefinitionsPass implements CompilerPassInterface
{
2011-02-13 18:06:41 +00:00
/**
2014-12-21 17:00:50 +00:00
* Removes abstract definitions from the ContainerBuilder.
2011-02-13 18:06:41 +00:00
*
2011-04-12 23:51:22 +01:00
* @param ContainerBuilder $container
2011-02-13 18:06:41 +00:00
*/
2011-01-26 23:14:31 +00:00
public function process(ContainerBuilder $container)
{
foreach ($container->getDefinitions() as $id => $definition) {
if ($definition->isAbstract()) {
$container->removeDefinition($id);
$container->log($this, sprintf('Removed service "%s"; reason: abstract.', $id));
2011-01-26 23:14:31 +00:00
}
}
}
2011-06-08 11:16:48 +01:00
}