public function AnalyzeServiceReferencesPass::process

Processes a ContainerBuilder object to populate the service reference graph.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

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

Class

AnalyzeServiceReferencesPass
Run this pass before passes that need to know more about the relation of your services.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  $this->container = $container;
  $this->graph = $container
    ->getCompiler()
    ->getServiceReferenceGraph();
  $this->graph
    ->clear();
  foreach ($container
    ->getDefinitions() as $id => $definition) {
    if ($definition
      ->isSynthetic() || $definition
      ->isAbstract()) {
      continue;
    }
    $this->currentId = $id;
    $this->currentDefinition = $definition;
    $this
      ->processArguments($definition
      ->getArguments());
    if (!$this->onlyConstructorArguments) {
      $this
        ->processArguments($definition
        ->getMethodCalls());
      $this
        ->processArguments($definition
        ->getProperties());
      if ($definition
        ->getConfigurator()) {
        $this
          ->processArguments(array(
          $definition
            ->getConfigurator(),
        ));
      }
    }
  }
  foreach ($container
    ->getAliases() as $id => $alias) {
    $this->graph
      ->connect($id, $alias, (string) $alias, $this
      ->getDefinition((string) $alias), null);
  }
}