コード例 #1
0
 /**
  * @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);
 }
コード例 #2
0
 /**
  * @return string
  */
 function getShortName()
 {
     return $this->astNode->getShortName();
 }