You are here

public function PassConfig::addPass in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Compiler/PassConfig.php \Symfony\Component\DependencyInjection\Compiler\PassConfig::addPass()

Adds a pass.

Parameters

CompilerPassInterface $pass A Compiler pass:

string $type The pass type:

Throws

InvalidArgumentException when a pass type doesn't exist

File

vendor/symfony/dependency-injection/Compiler/PassConfig.php, line 97

Class

PassConfig
Compiler Pass Configuration.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION) {
  $property = $type . 'Passes';
  if (!isset($this->{$property})) {
    throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type));
  }
  $passes =& $this->{$property};
  $passes[] = $pass;
}