class ResolveParameterPlaceHoldersPass

Resolves all parameter placeholders "%somevalue%" to their real values.

@author Johannes M. Schmitt <schmittjoh@gmail.com>

Hierarchy

Expanded class hierarchy of ResolveParameterPlaceHoldersPass

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php, line 22

Namespace

Symfony\Component\DependencyInjection\Compiler
View source
class ResolveParameterPlaceHoldersPass implements CompilerPassInterface {

  /**
   * Processes the ContainerBuilder to resolve parameter placeholders.
   *
   * @param ContainerBuilder $container
   */
  public function process(ContainerBuilder $container) {
    $parameterBag = $container
      ->getParameterBag();
    foreach ($container
      ->getDefinitions() as $id => $definition) {
      try {
        $definition
          ->setClass($parameterBag
          ->resolveValue($definition
          ->getClass()));
        $definition
          ->setFile($parameterBag
          ->resolveValue($definition
          ->getFile()));
        $definition
          ->setArguments($parameterBag
          ->resolveValue($definition
          ->getArguments()));
        $calls = array();
        foreach ($definition
          ->getMethodCalls() as $name => $arguments) {
          $calls[$parameterBag
            ->resolveValue($name)] = $parameterBag
            ->resolveValue($arguments);
        }
        $definition
          ->setMethodCalls($calls);
        $definition
          ->setProperties($parameterBag
          ->resolveValue($definition
          ->getProperties()));
      } catch (ParameterNotFoundException $e) {
        $e
          ->setSourceId($id);
        throw $e;
      }
    }
    $aliases = array();
    foreach ($container
      ->getAliases() as $name => $target) {
      $aliases[$parameterBag
        ->resolveValue($name)] = $parameterBag
        ->resolveValue($target);
    }
    $container
      ->setAliases($aliases);
    $parameterBag
      ->resolve();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ResolveParameterPlaceHoldersPass::process public function Processes the ContainerBuilder to resolve parameter placeholders. Overrides CompilerPassInterface::process