/** * @param \EBT\ExtensionBuilder\Domain\Model\AbstractObject $object * @param \PhpParser\Node\Stmt $node */ protected function addCommentsFromAttributes(Model\AbstractObject $object, \PhpParser\Node\Stmt $node) { $comments = $node->getAttribute('comments'); if (is_array($comments)) { foreach ($comments as $comment) { if ($comment instanceof \PhpParser\Comment\Doc) { $object->setDocComment($comment->getReformattedText()); } elseif ($comment instanceof \PhpParser\Comment) { $object->addComment($comment->getText()); } } } }
/** * Get the line number that this function ends on. * * @return int */ public function getEndLine() { return (int) $this->node->getAttribute('endLine', -1); }
private function verifyNotControlStructure(Node\Stmt $node) { $nodeType = str_replace('Stmt_', '', $node->getType()); if (isset(self::$constructStructureMap[$nodeType])) { throw ASTException::containsControlStructure(self::$constructStructureMap[$nodeType], $node->getAttribute('startLine')); } }
protected function buildClassLikeReflection(AbstractNode $node) { if ($node instanceof InterfaceNode) { $class = new ReflectionInterface((string) $node->namespacedName); } elseif ($node instanceof TraitNode) { $class = new ReflectionTrait((string) $node->namespacedName); } else { $class = new ReflectionClass((string) $node->namespacedName); } $class->setFilename((string) $this->context->getFilePath()); $class->setStartLine((int) $node->getAttribute('startLine')); $class->setEndLine((int) $node->getAttribute('endLine')); $class->setAliases($this->context->getAliases()); $class->setDocComment((string) $node->getDocComment()); $this->context->enterReflection($class); return $class; }