public function store_constant(Node\Expr\FuncCall $function_call)
 {
     $name = $function_call->args[0]->value->value;
     $value = $function_call->args[1]->value->value;
     if ($comments = $function_call->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('constants', array('constant' => $name, 'namespace' => !empty($function_call->namespacedName) ? implode('\\', array_slice($function_call->namespacedName->parts, 0, -1)) : '', 'file' => $this->_current_file, 'line' => $function_call->getLine(), 'value' => $value, 'type' => $this->get_type_for_node($function_call->args[1]->value), 'description' => $description));
 }
Exemplo n.º 2
0
 public function pExpr_FuncCall(\PhpParser\Node\Expr\FuncCall $node)
 {
     $firstToken = '';
     $lastToken = '';
     if (count($node->args) > 0) {
         if ($node->getAttribute('startLine') != reset($node->args)->getAttribute('startLine')) {
             $firstToken = LF . $this->indentToken;
         }
         if ($node->getAttribute('startLine') != end($node->args)->getAttribute('startLine')) {
             $lastToken = LF;
         }
     }
     return $this->p($node->name) . '(' . $firstToken . $this->pParameterNodes($node->args) . $lastToken . ')';
 }