/**
  * @param \Donquixote\HastyPhpAst\Ast\File\AstFileInterface $astFile
  * @param \Donquixote\HastyReflectionCommon\Canvas\ClassIndex\ClassIndexInterface $autoloadSource
  *
  * @return \Donquixote\HastyReflectionParser\AstToFileReflection\AstToFileReflection
  */
 function astGetFileReflection(AstFileInterface $astFile, ClassIndexInterface $autoloadSource)
 {
     $namespace = NULL;
     $useFqcnsByAlias = array();
     $classLikeNodes = array();
     foreach ($astFile->getNodes() as $node) {
         if ($node instanceof AstNamespaceDeclarationInterface) {
             $namespace = $node->getFqcn();
         } elseif ($node instanceof AstUseStatementInterface) {
             $useFqcnsByAlias += $node->getFqcnsByAlias();
         } elseif ($node instanceof AstClassLikeInterface) {
             $classLikeNodes[] = $node;
         }
     }
     $namesByAlias = array();
     foreach ($useFqcnsByAlias as $alias => $fqcn) {
         $namesByAlias[$alias] = $fqcn->getQualifiedName();
     }
     $context = new NamespaceUseContext($namespace->getQualifiedName(), $namesByAlias);
     $classesByQcn = array();
     foreach ($classLikeNodes as $node) {
         $class = ClassLikeReflection_Ast::create($context, $node, $autoloadSource);
         $classesByQcn[$class->getName()] = $class;
     }
     return new FileReflection($classesByQcn, $context);
 }
 /**
  * @param \Donquixote\HastyPhpAst\Ast\File\AstFileInterface $astFile
  *
  * @return \Donquixote\HastyPhpAst\Ast\ClassLike\AstClassLikeInterface[]
  */
 private function fileAstGetClassNodes(AstFileInterface $astFile)
 {
     $classNodes = array();
     foreach ($astFile->getNodes() as $astNode) {
         if ($astNode instanceof AstClassLikeInterface) {
             $classNodes[] = $astNode;
         }
     }
     return $classNodes;
 }