You are here

public function AnalyzeServiceReferencesPass::process in Zircon Profile 8.0

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

Processes a ContainerBuilder object to populate the service reference graph.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

vendor/symfony/dependency-injection/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 ($definition
      ->getFactoryService(false)) {
      $this
        ->processArguments(array(
        new Reference($definition
          ->getFactoryService(false)),
      ));
    }
    if (is_array($definition
      ->getFactory())) {
      $this
        ->processArguments($definition
        ->getFactory());
    }
    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);
  }
}