Example #1
0
 /**
  * @param ClassMethod $node
  *
  * @return NULL|\phpDocumentor\Reflection\DocBlock
  */
 private function nodeToDocBlock(ClassMethod $node)
 {
     $attribute = $node->getAttributes();
     if (isset($attribute['comments']) === false || isset($attribute['comments'][0]) === false) {
         return;
     }
     $docBlock = $attribute['comments'][0]->getText();
     return new DocBlock($docBlock);
 }
 /**
  * @param ClassMethod $node
  * @param Doc         $docComment
  */
 private function reapplyModifiedNode(ClassMethod $node, Doc $docComment)
 {
     $attributes = $node->getAttributes();
     $comments = isset($attributes['comments']) ? $attributes['comments'] : [];
     $lastComment = count($comments) ? $comments[count($comments) - 1] : null;
     if (!$lastComment instanceof Doc) {
         $comments[] = $docComment;
     } else {
         $comments[count($comments) - 1] = $docComment;
     }
     $node->setAttribute('comments', $comments);
 }