Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\DependencyInjection\Compiler; Chris@0: Chris@0: use Symfony\Component\DependencyInjection\ContainerBuilder; Chris@0: Chris@0: /** Chris@0: * Remove private aliases from the container. They were only used to establish Chris@0: * dependencies between services, and these dependencies have been resolved in Chris@0: * one of the previous passes. Chris@0: * Chris@0: * @author Johannes M. Schmitt Chris@0: */ Chris@0: class RemovePrivateAliasesPass implements CompilerPassInterface Chris@0: { Chris@0: /** Chris@0: * Removes private aliases from the ContainerBuilder. Chris@0: */ Chris@0: public function process(ContainerBuilder $container) Chris@0: { Chris@0: foreach ($container->getAliases() as $id => $alias) { Chris@14: if ($alias->isPublic() || $alias->isPrivate()) { Chris@0: continue; Chris@0: } Chris@0: Chris@0: $container->removeAlias($id); Chris@14: $container->log($this, sprintf('Removed service "%s"; reason: private alias.', $id)); Chris@0: } Chris@0: } Chris@0: }