getParams() публичный Метод

public getParams ( )
 private function removeTypeHints(ClassMethod $node)
 {
     foreach ($node->getParams() as $param) {
         if ($param->type instanceof Node\Name) {
             $param->type = null;
         }
     }
 }
 /**
  * @param Node\Stmt\ClassMethod $node
  * @param string                $text
  *
  * @return string
  */
 public function addParams(Node\Stmt\ClassMethod $node, $text)
 {
     $docBlock = new Docblock($text);
     foreach ($node->getParams() as $param) {
         $type = $this->getFullyQualifiedParamType($param);
         if (null === $type) {
             continue;
         }
         $docBlock->appendTag(new ParamTag((string) $type . ' $' . $param->name));
     }
     return str_replace("* \n", "*\n", $docBlock->toString());
     //TODO remove once https://github.com/gossi/docblock/pull/2 is merged
 }
Пример #3
0
 /**
  * @param Node\Stmt\ClassMethod $node
  * @param string                $text
  *
  * @return string
  */
 public function addParams(Node\Stmt\ClassMethod $node, $text)
 {
     $docBlock = new Docblock($text);
     foreach ($node->getParams() as $param) {
         if ($param->type && $param->type instanceof Node\Name) {
             $type = $this->resolver->resolve(implode('\\', $param->type->parts), $this->context);
             $type = str_replace('\\\\', '\\', $type);
         } elseif ($param->type && is_string($param->type)) {
             $type = $param->type;
         }
         if (!isset($type)) {
             continue;
         }
         $docBlock->appendTag(new ParamTag((string) $type . ' $' . $param->name));
     }
     $string = $docBlock->toString();
     return str_replace("* \n", "*\n", $string);
     //TODO remove once https://github.com/gossi/docblock/pull/2 is merged
 }
 public function store_class_method(Node\Stmt\Class_ $class, Node\Stmt\ClassMethod $method)
 {
     $parameters = array_map(function ($param) {
         return array('name' => $param->name, 'default' => !empty($param->default), 'type' => ltrim((string) $param->type, '\\'));
     }, $method->getParams());
     $access = array_keys(array_filter(array('public' => $method->isPublic(), 'protected' => $method->isProtected(), 'private' => $method->isPrivate())))[0];
     $return_types = array();
     $description = '';
     if ($comments = $method->getAttribute('comments')) {
         $phpdoc = new DocBlock($comments[0]->getText());
         $description = $phpdoc->getShortDescription();
         if ($return = $phpdoc->getTagsByName('return')) {
             $return_types = array_map('ltrim', explode('|', $return[0]->getType()), array('\\'));
         }
         // short circuit @ignore functions
         if ($phpdoc->hasTag('ignore')) {
             return;
         }
     }
     $this->store_model('methods', array('method' => $method->name, 'namespace' => !empty($method->namespacedName) ? implode('\\', array_slice($method->namespacedName->parts, 0, -1)) : '', 'file' => $this->_current_file, 'line' => $method->getLine(), 'description' => $description, 'return_types' => json_encode($return_types), 'parameters' => json_encode($parameters), 'access' => $access, 'is_static' => $method->isStatic(), 'class' => $class->name));
 }