Drupal investigation

RemoveAbstractDefinitionsPass.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Compiler;
  11. use Symfony\Component\DependencyInjection\ContainerBuilder;
  12. /**
  13. * Removes abstract Definitions.
  14. */
  15. class RemoveAbstractDefinitionsPass implements CompilerPassInterface
  16. {
  17. /**
  18. * Removes abstract definitions from the ContainerBuilder.
  19. *
  20. * @param ContainerBuilder $container
  21. */
  22. public function process(ContainerBuilder $container)
  23. {
  24. $compiler = $container->getCompiler();
  25. $formatter = $compiler->getLoggingFormatter();
  26. foreach ($container->getDefinitions() as $id => $definition) {
  27. if ($definition->isAbstract()) {
  28. $container->removeDefinition($id);
  29. $compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'abstract'));
  30. }
  31. }
  32. }
  33. }