Beispiel #1
0
 /**
  * Parses ClassMethod node to MethodData
  *
  * @return MethodData
  */
 public function parse(ClassMethod $node)
 {
     $method = new MethodData($node->name);
     $method->startLine = $node->getAttribute("startLine");
     $method->endLine = $node->getAttribute("endLine");
     $method->setType($node->type);
     $comments = $node->getAttribute("comments");
     if (is_array($comments)) {
         /** @var Comment */
         $comment = $this->commentParser->parse($comments[count($comments) - 1]->getText());
         if ($comment->isInheritDoc()) {
             $method->doc = Comment::INHERIT_MARK;
         } else {
             $method->doc = $comment->getDoc();
             $method->return = $comment->getReturn();
             foreach ($comment->getVars() as $var) {
                 if ($var instanceof MethodParam) {
                     $method->addParam($var);
                 }
             }
         }
     }
     foreach ($node->params as $child) {
         if ($child instanceof Param) {
             $method->addParam($this->parseMethodArgument($child));
         }
     }
     return $method;
 }
function createClass($classFQN, $fqcn)
{
    $class = new ClassData($classFQN, 'dummy/path/class.php');
    $method = new MethodData('method2');
    $method->setType(ClassData::MODIFIER_PUBLIC);
    $param = new ClassProperty('param2');
    $param->type = $fqcn;
    $method->setReturn($fqcn);
    $class->addMethod($method);
    $class->addProp($param);
    return $class;
}
 /**
  * Creates menu entry for MethodData
  *
  * @param MethodData $method a method
  * @return Entry
  */
 protected function createEntryForMethod(MethodData $method)
 {
     return new Entry($method->name, $method->getSignature(), sprintf("%s\n%s\n", $method->getSignature(), $method->doc));
 }