public function addConstant(ClassConstNode $node) { foreach ($node->consts as $const) { $constant = new ReflectionConstant($const->name); $constant->setStartLine((int) $node->getAttribute('startLine')); $constant->setEndLine((int) $node->getAttribute('endLine')); $constant->setDocComment((string) $node->getDocComment()); $constant->setValue($this->resolveValue($const->value)); $this->context->getReflection()->addConstant($constant); } }
public function store_class_constant(Node\Stmt\Class_ $class, Node\Stmt\ClassConst $constant) { if ($comments = $constant->getAttribute('comments')) { $phpdoc = new DocBlock($comments[0]->getText()); $description = $phpdoc->getShortDescription(); // short circuit @ignore functions if ($phpdoc->hasTag('ignore')) { return; } } else { $description = ''; } $this->store_model('class_constants', array('constant' => $constant->consts[0]->name, 'class' => $class->name, 'namespace' => !empty($class->namespacedName) ? implode('\\', array_slice($class->namespacedName->parts, 0, -1)) : '', 'file' => $this->_current_file, 'line' => $constant->getLine(), 'type' => $this->get_type_for_node($constant->consts[0]->value), 'description' => $description)); }