/** * @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); }
/** * @param \Donquixote\HastyReflectionCommon\NamespaceUseContext\NamespaceUseContextInterface $namespaceUseContext * @param \Donquixote\HastyPhpAst\Ast\ClassLike\AstClassLikeInterface $astNode * @param \Donquixote\HastyReflectionCommon\Canvas\ClassIndex\ClassIndexInterface $classIndex * * @return \Donquixote\HastyReflectionCommon\Reflection\ClassLike\ClassLikeReflectionInterface */ static function create(NamespaceUseContextInterface $namespaceUseContext, AstClassLikeInterface $astNode, ClassIndexInterface $classIndex) { $declaration = new Declaration($astNode->getDocComment(), $namespaceUseContext); $name = NULL !== ($namespace = $namespaceUseContext->getNamespaceName()) ? $namespace . '\\' . $astNode->getShortName() : $astNode->getShortName(); $header = new ClassLikeHeader_Ast($name, $astNode); $extends = ClassExtends_Ast::createFromAst($astNode, $classIndex, $namespaceUseContext); $ownInterfaces = OwnInterfaces_Ast::createFromAst($astNode, $classIndex, $namespaceUseContext); $interfacesAll = new AllInterfaces_FromOwn($extends, $ownInterfaces); if ($header->isInterface()) { $interfacesAll = $interfacesAll->withSelfInterfaceName($name, $classIndex); } $ownBody = new OwnBody_Ast($astNode->getBody(), $classIndex, $name); $body = ClassLikeBody_Composite::createFromOwnBody($extends, $interfacesAll, $ownBody); return new ClassLikeReflection_Composite($declaration, $header, $extends, $interfacesAll, $ownInterfaces, $body); }
/** * @return bool */ function isFinal() { return $this->astNode->hasModifier(T_FINAL); }