You are here

private static function ClassCollectionLoader::getClassHierarchy in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/class-loader/ClassCollectionLoader.php \Symfony\Component\ClassLoader\ClassCollectionLoader::getClassHierarchy()
1 call to ClassCollectionLoader::getClassHierarchy()
ClassCollectionLoader::getOrderedClasses in vendor/symfony/class-loader/ClassCollectionLoader.php
Gets an ordered array of passed classes including all their dependencies.

File

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

Class

ClassCollectionLoader
ClassCollectionLoader.

Namespace

Symfony\Component\ClassLoader

Code

private static function getClassHierarchy(\ReflectionClass $class) {
  if (isset(self::$seen[$class
    ->getName()])) {
    return array();
  }
  self::$seen[$class
    ->getName()] = true;
  $classes = array(
    $class,
  );
  $parent = $class;
  while (($parent = $parent
    ->getParentClass()) && $parent
    ->isUserDefined() && !isset(self::$seen[$parent
    ->getName()])) {
    self::$seen[$parent
      ->getName()] = true;
    array_unshift($classes, $parent);
  }
  $traits = array();
  if (method_exists('ReflectionClass', 'getTraits')) {
    foreach ($classes as $c) {
      foreach (self::resolveDependencies(self::computeTraitDeps($c), $c) as $trait) {
        if ($trait !== $c) {
          $traits[] = $trait;
        }
      }
    }
  }
  return array_merge(self::getInterfaces($class), $traits, $classes);
}