You are here

private static function ClassCollectionLoader::resolveDependencies in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/class-loader/ClassCollectionLoader.php \Symfony\Component\ClassLoader\ClassCollectionLoader::resolveDependencies()

Dependencies resolution.

This function does not check for circular dependencies as it should never occur with PHP traits.

Parameters

array $tree The dependency tree:

\ReflectionClass $node The node:

\ArrayObject $resolved An array of already resolved dependencies:

\ArrayObject $unresolved An array of dependencies to be resolved:

Return value

\ArrayObject The dependencies for the given node

Throws

\RuntimeException if a circular dependency is detected

1 call to ClassCollectionLoader::resolveDependencies()
ClassCollectionLoader::getClassHierarchy in vendor/symfony/class-loader/ClassCollectionLoader.php

File

vendor/symfony/class-loader/ClassCollectionLoader.php, line 347

Class

ClassCollectionLoader
ClassCollectionLoader.

Namespace

Symfony\Component\ClassLoader

Code

private static function resolveDependencies(array $tree, $node, \ArrayObject $resolved = null, \ArrayObject $unresolved = null) {
  if (null === $resolved) {
    $resolved = new \ArrayObject();
  }
  if (null === $unresolved) {
    $unresolved = new \ArrayObject();
  }
  $nodeName = $node
    ->getName();
  if (isset($tree[$nodeName])) {
    $unresolved[$nodeName] = $node;
    foreach ($tree[$nodeName] as $dependency) {
      if (!$resolved
        ->offsetExists($dependency
        ->getName())) {
        self::resolveDependencies($tree, $dependency, $resolved, $unresolved);
      }
    }
    $resolved[$nodeName] = $node;
    unset($unresolved[$nodeName]);
  }
  return $resolved;
}