12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace Symfony\Component\DependencyInjection\Compiler;
- use Symfony\Component\DependencyInjection\ContainerBuilder;
- use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
- class RepeatedPass implements CompilerPassInterface
- {
-
- private $repeat = false;
- private $passes;
-
- public function __construct(array $passes)
- {
- foreach ($passes as $pass) {
- if (!$pass instanceof RepeatablePassInterface) {
- throw new InvalidArgumentException('$passes must be an array of RepeatablePassInterface.');
- }
- $pass->setRepeatedPass($this);
- }
- $this->passes = $passes;
- }
-
- public function process(ContainerBuilder $container)
- {
- do {
- $this->repeat = false;
- foreach ($this->passes as $pass) {
- $pass->process($container);
- }
- } while ($this->repeat);
- }
-
- public function setRepeat()
- {
- $this->repeat = true;
- }
-
- public function getPasses()
- {
- return $this->passes;
- }
- }
|