isAbstract() public method

public isAbstract ( )
Ejemplo n.º 1
0
 /**
  * @param Class_       $node
  * @param PHPNamespace $target
  */
 public function handleClass(Class_ $node, PHPNamespace $target)
 {
     $name = $node->name;
     $modifiers = 0;
     $modifiers |= $node->isAbstract() ? PHPClass::IS_ABSTRACT : 0;
     $modifiers |= $node->isFinal() ? PHPClass::IS_FINAL : 0;
     $class = $this->codeFactory->buildClass($name, $modifiers);
     $target->addClass($class);
     $this->parse($node->stmts, $class);
 }
 public function visitClass(Class_ $node)
 {
     $struct = $this->getStruct();
     if ($node->extends !== null) {
         $struct->setParentClassName(implode('\\', $node->extends->parts));
     }
     foreach ($node->implements as $name) {
         $struct->addInterface(implode('\\', $name->parts));
     }
     $struct->setAbstract($node->isAbstract());
     $struct->setFinal($node->isFinal());
 }
 /**
  * @param Node\Stmt\Class_ $node
  */
 protected function parseClassNode(Node\Stmt\Class_ $node)
 {
     if (!isset($node->namespacedName)) {
         return;
         // Ticket #45 - This could potentially not be set for PHP 7 anonymous classes.
     }
     $this->currentStructuralElement = $node;
     $interfaces = [];
     /** @var Node\Name $implementedName */
     foreach ($node->implements as $implementedName) {
         $interfaces[] = $implementedName->toString();
     }
     $this->structuralElements[$node->namespacedName->toString()] = ['name' => $node->name, 'type' => 'class', 'startLine' => $node->getLine(), 'isAbstract' => $node->isAbstract(), 'docComment' => $node->getDocComment() ? $node->getDocComment()->getText() : null, 'parents' => $node->extends ? [$node->extends->toString()] : [], 'interfaces' => $interfaces, 'traits' => [], 'methods' => [], 'properties' => [], 'constants' => []];
 }
 /**
  * @param Node\Stmt\Class_ $node
  */
 private function collectMetaOfClass(Node\Stmt\Class_ $node)
 {
     $this->getAdtMeta()->setClass();
     if ($node->isAbstract()) {
         $this->getAdtMeta()->setAbstract();
     }
     if ($node->isFinal()) {
         $this->getAdtMeta()->setFinal();
     }
     foreach ($node->implements as $name) {
         if ($name = $this->filter($name)) {
             $this->getAdtMeta()->addImplementedNamespace($name);
         }
     }
     $this->collectExtends($node->extends);
 }
Ejemplo n.º 5
0
 private function handleClass(Node\Stmt\Class_ $class)
 {
     $classHint = new ClassHint();
     if (!$class->isAbstract()) {
         $classHint->setStmtType("Class");
         $classHint->setName($class->name);
         $classHint->setFqn($this->namespace . "\\" . $class->name);
         $classHint->setClassType($class->type);
         if ($class->extends instanceof Node) {
             $classHint->setExtends($class->extends->toString());
         }
         foreach ($class->stmts as $stmt) {
             $paramNames = [];
             $docComment = null;
             if ($stmt instanceof Node\Stmt\ClassMethod && ($stmt->isPublic() || $stmt->isProtected())) {
                 $docComment = $stmt->getDocComment();
                 if ($docComment !== null) {
                     $docComment = $docComment->getReformattedText();
                 }
                 $classHint->addMethod($stmt->name, $stmt->type, $stmt->byRef, $stmt->params, $docComment);
             }
             if ($stmt instanceof Node\Stmt\Property && ($stmt->isPublic() || $stmt->isProtected())) {
                 $docComment = $stmt->getDocComment();
                 if ($docComment !== null) {
                     $docComment = $docComment->getReformattedText();
                 }
                 $classHint->addProperty($stmt->props, $stmt->type, $docComment);
             }
             if ($stmt instanceof Node\Stmt\ClassConst) {
                 $docComment = $stmt->getDocComment();
                 if ($docComment !== null) {
                     $docComment = $docComment->getReformattedText();
                 }
                 $classHint->addConstant($stmt->consts, $docComment);
             }
         }
         $this->fileStmts[] = ['stmtType' => $classHint->getStmtType(), 'name' => $classHint->getName(), 'fqn' => $classHint->getFqn(), 'type' => $classHint->getClassType(), 'extendsClass' => $classHint->getExtends(), 'methods' => $classHint->getMethods(), 'properties' => $classHint->getProperties(), 'constants' => $classHint->getConstants()];
     }
 }