ExtensionCompilerPass.php 892 B

12345678910111213141516171819202122232425262728293031323334353637
  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. * A pass to automatically process extensions if they implement
  14. * CompilerPassInterface.
  15. *
  16. * @author Wouter J <wouter@wouterj.nl>
  17. */
  18. class ExtensionCompilerPass implements CompilerPassInterface
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function process(ContainerBuilder $container)
  24. {
  25. foreach ($container->getExtensions() as $extension) {
  26. if (!$extension instanceof CompilerPassInterface) {
  27. continue;
  28. }
  29. $extension->process($container);
  30. }
  31. }
  32. }