You are here

public function PassConfig::addPass in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/PassConfig.php \Symfony\Component\DependencyInjection\Compiler\PassConfig::addPass()

Adds a pass.

@api

Parameters

CompilerPassInterface $pass A Compiler pass:

string $type The pass type:

Throws

InvalidArgumentException when a pass type doesn't exist

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/PassConfig.php, line 102

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;
}