BootstrapCompilerPass.php

Namespace

Drush\Symfony

Classes

File

lib/Drush/Symfony/BootstrapCompilerPass.php
View source
  1. <?php
  2. namespace Drush\Symfony;
  3. use Symfony\Component\DependencyInjection\ContainerBuilder;
  4. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  5. use Symfony\Component\DependencyInjection\Reference;
  6. class BootstrapCompilerPass implements CompilerPassInterface
  7. {
  8. public function process(ContainerBuilder $container)
  9. {
  10. if (!$container->has('bootstrap.manager')) {
  11. return;
  12. }
  13. $definition = $container->findDefinition(
  14. 'bootstrap.manager'
  15. );
  16. $taggedServices = $container->findTaggedServiceIds(
  17. 'bootstrap.boot'
  18. );
  19. foreach ($taggedServices as $id => $tags) {
  20. $definition->addMethodCall(
  21. 'add',
  22. array(new Reference($id))
  23. );
  24. }
  25. }
  26. }