You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

3 years ago
  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\HttpKernel\DependencyInjection;
  11. use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass as BaseMergeExtensionConfigurationPass;
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. /**
  14. * Ensures certain extensions are always loaded.
  15. *
  16. * @author Kris Wallsmith <kris@symfony.com>
  17. */
  18. class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPass
  19. {
  20. private $extensions;
  21. public function __construct(array $extensions)
  22. {
  23. $this->extensions = $extensions;
  24. }
  25. public function process(ContainerBuilder $container)
  26. {
  27. foreach ($this->extensions as $extension) {
  28. if (!\count($container->getExtensionConfig($extension))) {
  29. $container->loadFromExtension($extension, []);
  30. }
  31. }
  32. parent::process($container);
  33. }
  34. }