You are here

private function CheckCircularReferencesPass::checkOutEdges in Service Container 7

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

Checks for circular references.

Parameters

ServiceReferenceGraphEdge[] $edges An array of Edges:

Throws

ServiceCircularReferenceException When a circular reference is found.

1 call to CheckCircularReferencesPass::checkOutEdges()
CheckCircularReferencesPass::process in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php
Checks the ContainerBuilder object for circular references.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php, line 56

Class

CheckCircularReferencesPass
Checks your services for circular references.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

private function checkOutEdges(array $edges) {
  foreach ($edges as $edge) {
    $node = $edge
      ->getDestNode();
    $id = $node
      ->getId();
    if (empty($this->checkedNodes[$id])) {
      $searchKey = array_search($id, $this->currentPath);
      $this->currentPath[] = $id;
      if (false !== $searchKey) {
        throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey));
      }
      $this
        ->checkOutEdges($node
        ->getOutEdges());
      $this->checkedNodes[$id] = true;
      array_pop($this->currentPath);
    }
  }
}