/** * Returns the name for this Reflector instance. * * @return string[] Index 0 is the calling instance, 1 is the method name. */ public function getName() { if ('Expr_New' === $this->node->getType()) { $name = '__construct'; $caller = $this->node->class; } else { $name = $this->getShortName(); $caller = $this->node->var; } if ($caller instanceof \PHPParser_Node_Expr) { $printer = new Pretty_Printer(); $caller = $printer->prettyPrintExpr($caller); } elseif ($caller instanceof \PHPParser_Node_Name) { $caller = $caller->toString(); } $caller = $this->_resolveName($caller); // If the caller is a function, convert it to the function name if (is_a($caller, 'PHPParser_Node_Expr_FuncCall')) { // Add parentheses to signify this is a function call /** @var \PHPParser_Node_Expr_FuncCall $caller */ $caller = $caller->name->parts[0] . '()'; } $class_mapping = $this->_getClassMapping(); if (array_key_exists($caller, $class_mapping)) { $caller = $class_mapping[$caller]; } return array($caller, $name); }
/** * @return array */ public function getArgs() { $printer = new Pretty_Printer(); $args = array(); foreach ($this->node->args as $arg) { $args[] = $printer->prettyPrintArg($arg); } // Skip the filter name array_shift($args); return $args; }