original_string: 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();
          $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;
      }
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();
          $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;
      }
code_tokens: 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 ( ) ; $ 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 ; }
docstring: Dependencies resolution.
  
  This function does not check for circular dependencies as it should never
  occur with PHP traits.
  
  @param array             $tree       The dependency tree
  @param \ReflectionClass  $node       The node
  @param \ArrayObject      $resolved   An array of already resolved dependencies
  @param \ArrayObject      $unresolved An array of dependencies to be resolved
  
  @return \ArrayObject The dependencies for the given node
  
  @throws \RuntimeException if a circular dependency is detected
docstring_tokens: Dependencies resolution .