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
$lineEnding  : string
__construct()  : mixed
Create a Serializer instance.
getDocComment()  : string
Generate a DocBlock comment.
addAsterisksForEachLine()  : string
addTagBlock()  : string
getSummaryAndDescriptionTextBlock()  : string
removeTrailingSpaces()  : string

Properties

$indent

protected int $indent = 0

The number of times the indent string is repeated.

$indentString

protected string $indentString = ' '

The string to indent the comment with.

$isFirstLineIndented

protected bool $isFirstLineIndented = true

Whether to indent the first line with the given indent amount and string.

$lineLength

protected int|null $lineLength

The max length of a line.

Methods

__construct()

Create a Serializer instance.

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

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.

$lineEnding : string = " "

Line ending used in the output, by default \n is used.

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