Serializer
in package
Serializes a DocBlock instance.
Tags
Table of Contents
- $indent : int
- $indentString : string
- $isFirstLineIndented : bool
- $lineLength : int|null
- __construct() : mixed
- Create a Serializer instance.
- getDocComment() : string
- Generate a DocBlock comment.
- getIndent() : int
- Gets the number of indents.
- getIndentationString() : string
- Gets the string to indent comments with.
- getLineLength() : int|null
- Gets the line length.
- isFirstLineIndented() : bool
- Gets whether or not the first line should be indented.
- setIndent() : $this
- Sets the number of indents.
- setIndentationString() : $this
- Sets the string to indent comments with.
- setIsFirstLineIndented() : $this
- Sets whether or not the first line should be indented.
- setLineLength() : $this
- Sets the line length.
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.
$lineLength
protected
int|null
$lineLength
= null
The max length of a line.
Methods
__construct()
Create a Serializer instance.
public
__construct(int $indent[, string $indentString = ' ' ][, bool $indentFirstLine = true ][, int|null $lineLength = 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.
Return values
mixed —getDocComment()
Generate a DocBlock comment.
public
getDocComment(DocBlock $docblock) : string
Parameters
- $docblock : DocBlock
Return values
string —The serialized doc block.
getIndent()
Gets the number of indents.
public
getIndent() : int
Return values
int —The number of times the indent string is repeated.
getIndentationString()
Gets the string to indent comments with.
public
getIndentationString() : string
Return values
string —The indent string.
getLineLength()
Gets the line length.
public
getLineLength() : int|null
Return values
int|null —The length of each line or NULL if line wrapping is disabled.
isFirstLineIndented()
Gets whether or not the first line should be indented.
public
isFirstLineIndented() : bool
Return values
bool —Whether or not the first line should be indented.
setIndent()
Sets the number of indents.
public
setIndent(int $indent) : $this
Parameters
- $indent : int
-
The number of times the indent string is repeated.
Return values
$this —This serializer object.
setIndentationString()
Sets the string to indent comments with.
public
setIndentationString(mixed $indentString) : $this
Parameters
- $indentString : mixed
Return values
$this —This serializer object.
setIsFirstLineIndented()
Sets whether or not the first line should be indented.
public
setIsFirstLineIndented(bool $indentFirstLine) : $this
Sets whether or not the first line (the one with the "/**") should be indented.
Parameters
- $indentFirstLine : bool
-
The new value for this setting.
Return values
$this —This serializer object.
setLineLength()
Sets the line length.
public
setLineLength(int|null $lineLength) : $this
Sets the length of each line in the serialization. Content will be wrapped within this limit.
Parameters
- $lineLength : int|null
-
The length of each line. NULL to disable line wrapping altogether.
Return values
$this —This serializer object.