class Serializer

Class Serializer - Serializes a DocBlock instance.

Properties

protected string $indentString
protected int $indent
protected bool $isFirstLineIndented
protected int|null $lineLength

Methods

__construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, int|null $lineLength = null)

Create a Serializer instance.

setIndentationString(string $indentString)

Sets the string to indent comments with.

string
getIndentationString()

Gets the string to indent comments with.

setIndent(int $indent)

Sets the number of indents.

int
getIndent()

Gets the number of indents.

setIsFirstLineIndented(bool $indentFirstLine)

Sets whether or not the first line should be indented.

bool
isFirstLineIndented()

Gets whether or not the first line should be indented.

setLineLength(int|null $lineLength)

Sets the line length.

int|null
getLineLength()

Gets the line length.

string
getDocComment(DocBlock $docblock)

Generate a DocBlock comment.

Details

at line 38
__construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, int|null $lineLength = null)

Create a Serializer instance.

Parameters

int $indent The number of times the indent string is repeated.
string $indentString The string to indent the comment with.
bool $indentFirstLine Whether to indent the first line.
int|null $lineLength The max length of a line or NULL to disable line wrapping.

at line 53
Serializer setIndentationString(string $indentString)

Sets the string to indent comments with.

Parameters

string $indentString The string to indent comments with.

Return Value

Serializer

at line 65
string getIndentationString()

Gets the string to indent comments with.

Return Value

string The indent string.

at line 77
Serializer setIndent(int $indent)

Sets the number of indents.

Parameters

int $indent The number of times the indent string is repeated.

Return Value

Serializer

at line 89
int getIndent()

Gets the number of indents.

Return Value

int The number of times the indent string is repeated.

at line 103
Serializer setIsFirstLineIndented(bool $indentFirstLine)

Sets whether or not the first line should be indented.

Sets whether or not the first line (the one with the "/**") should be indented.

Parameters

bool $indentFirstLine The new value for this setting.

Return Value

Serializer

at line 115
bool isFirstLineIndented()

Gets whether or not the first line should be indented.

Return Value

bool Whether or not the first line should be indented.

at line 129
Serializer setLineLength(int|null $lineLength)

Sets the line length.

Sets the length of each line in the serialization. Content will be wrapped within this limit.

Parameters

int|null $lineLength The length of each line. NULL to disable line wrapping altogether.

Return Value

Serializer

at line 141
int|null getLineLength()

Gets the line length.

Return Value

int|null The length of each line or NULL if line wrapping is disabled.

at line 153
string getDocComment(DocBlock $docblock)

Generate a DocBlock comment.

Parameters

DocBlock $docblock The DocBlock to serialize.

Return Value

string The serialized doc block.