Documentation

Serializer
in package

Converts a DocBlock back from an object to a complete DocComment including Asterisks.

Table of Contents

$indent  : int
$indentString  : string
$isFirstLineIndented  : bool
$lineLength  : int|null
$tagFormatter  : Formatter
__construct()  : mixed
Create a Serializer instance.
getDocComment()  : string
Generate a DocBlock comment.
addAsterisksForEachLine()  : string
addTagBlock()  : string
getSummaryAndDescriptionTextBlock()  : string
removeTrailingSpaces()  : string

Properties

$indentString

protected string $indentString = ' '

$isFirstLineIndented

protected bool $isFirstLineIndented = true

Methods

__construct()

Create a Serializer instance.

public __construct(int $indent[, string $indentString = ' ' ][, bool $indentFirstLine = true ][, int|null $lineLength = null ][, Formatter $tagFormatter = null ]) : mixed
Parameters
$indent : int

The number of times the indent string is repeated.

$indentString : string = ' '

The string to indent the comment with.

$indentFirstLine : bool = true

Whether to indent the first line.

$lineLength : int|null = null

The max length of a line or NULL to disable line wrapping.

$tagFormatter : Formatter = null

A custom tag formatter, defaults to PassthroughFormatter.

Return values
mixed

getDocComment()

Generate a DocBlock comment.

public getDocComment(DocBlock $docblock) : string
Parameters
$docblock : DocBlock

The DocBlock to serialize.

Return values
string

The serialized doc block.

addAsterisksForEachLine()

private addAsterisksForEachLine(string $indent, string $text) : string
Parameters
$indent : string
$text : string
Return values
string

addTagBlock()

private addTagBlock(DocBlock $docblock, int|null $wrapLength, string $indent, string $comment) : string
Parameters
$docblock : DocBlock
$wrapLength : int|null
$indent : string
$comment : string
Return values
string

getSummaryAndDescriptionTextBlock()

private getSummaryAndDescriptionTextBlock(DocBlock $docblock, int|null $wrapLength) : string
Parameters
$docblock : DocBlock
$wrapLength : int|null
Return values
string

removeTrailingSpaces()

private removeTrailingSpaces(string $indent, string $text) : string
Parameters
$indent : string
$text : string
Return values
string

Search results