original_string: private function checkOutEdges(array $edges)
      {
          foreach ($edges as $edge) {
              $node = $edge->getDestNode();
              $id = $node->getId();
  
              if (empty($this->checkedNodes[$id])) {
                  // Don't check circular references for lazy edges
                  if (!$node->getValue() || (!$edge->isLazy() && !$edge->isWeak())) {
                      $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);
              }
          }
      }
code: private function checkOutEdges(array $edges)
      {
          foreach ($edges as $edge) {
              $node = $edge->getDestNode();
              $id = $node->getId();
  
              if (empty($this->checkedNodes[$id])) {
                  // Don't check circular references for lazy edges
                  if (!$node->getValue() || (!$edge->isLazy() && !$edge->isWeak())) {
                      $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);
              }
          }
      }
code_tokens: private function checkOutEdges ( array $ edges ) { foreach ( $ edges as $ edge ) { $ node = $ edge -> getDestNode ( ) ; $ id = $ node -> getId ( ) ; if ( empty ( $ this -> checkedNodes [ $ id ] ) ) { // Don't check circular references for lazy edges if ( ! $ node -> getValue ( ) || ( ! $ edge -> isLazy ( ) && ! $ edge -> isWeak ( ) ) ) { $ 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 ) ; } } }
docstring: Checks for circular references.
  
  @param ServiceReferenceGraphEdge[] $edges An array of Edges
  
  @throws ServiceCircularReferenceException when a circular reference is found
docstring_tokens: Checks for circular references .