function Serializer::getDocComment
Generate a DocBlock comment.
Parameters
DocBlock $docblock The DocBlock to serialize.:
Return value
string The serialized doc block.
File
-
vendor/
phpdocumentor/ reflection-docblock/ src/ DocBlock/ Serializer.php, line 80
Class
- Serializer
- Converts a DocBlock back from an object to a complete DocComment including Asterisks.
Namespace
phpDocumentor\Reflection\DocBlockCode
public function getDocComment(DocBlock $docblock) : string {
$indent = str_repeat($this->indentString, $this->indent);
$firstIndent = $this->isFirstLineIndented ? $indent : '';
// 3 === strlen(' * ')
$wrapLength = $this->lineLength !== null ? $this->lineLength - strlen($indent) - 3 : null;
$text = $this->removeTrailingSpaces($indent, $this->addAsterisksForEachLine($indent, $this->getSummaryAndDescriptionTextBlock($docblock, $wrapLength)));
$comment = $firstIndent . "/**\n";
if ($text) {
$comment .= $indent . ' * ' . $text . "\n";
$comment .= $indent . " *\n";
}
$comment = $this->addTagBlock($docblock, $wrapLength, $indent, $comment);
return str_replace("\n", $this->lineEnding, $comment . $indent . ' */');
}