Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Serializer.php

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\DocBlock

Code

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 . ' */');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal