/** * @param \Donquixote\HastyPhpAst\Ast\ClassLike\AstClassLikeInterface $astClassLike * @param \Donquixote\HastyReflectionCommon\Canvas\ClassIndex\ClassIndexInterface $classIndex * @param \Donquixote\HastyReflectionCommon\NamespaceUseContext\NamespaceUseContextInterface $namespaceUseContext * * @return \Donquixote\HastyReflectionCommon\Reflection\ClassLike\ClassExtends\ClassExtendsInterface */ static function createFromAst(AstClassLikeInterface $astClassLike, ClassIndexInterface $classIndex, NamespaceUseContextInterface $namespaceUseContext) { $extendsAliases = $astClassLike->getExtendsAliases(); if ($astClassLike->hasModifier(T_INTERFACE)) { return new ClassExtends_None(); } $parentClassAlias = reset($extendsAliases); if (FALSE === $parentClassAlias) { return new ClassExtends_None(); } return new ClassExtends_ByName($classIndex, $namespaceUseContext->aliasGetName($parentClassAlias)); }
/** * @param \Donquixote\HastyPhpAst\Ast\ClassLike\AstClassLikeInterface $astClassLike * @param \Donquixote\HastyReflectionCommon\Canvas\ClassIndex\ClassIndexInterface $classIndex * @param \Donquixote\HastyReflectionCommon\NamespaceUseContext\NamespaceUseContextInterface $namespaceUseContext * * @return \Donquixote\HastyReflectionCommon\Reflection\ClassLike\OwnInterfaces\OwnInterfacesInterface */ static function createFromAst(AstClassLikeInterface $astClassLike, ClassIndexInterface $classIndex, NamespaceUseContextInterface $namespaceUseContext) { if ($astClassLike->hasModifier(T_INTERFACE)) { $interfaceAliases = $astClassLike->getExtendsAliases(); } else { $interfaceAliases = $astClassLike->getImplementsAliases(); } $ownInterfaceNames = array(); foreach ($interfaceAliases as $interfaceAlias) { $ownInterfaceNames[] = $namespaceUseContext->aliasGetName($interfaceAlias); } return new OwnInterfaces_FromNames($classIndex, $ownInterfaceNames); }