DocblockGenerator
extends AbstractGenerator
in package
Abstract generator class
Tags
Table of Contents
Properties
- $desc : string|null
- Docblock description
- $indent : int
- Code indent spaces
- $output : string|null
- Output string
- $tags : array<string|int, mixed>
- Docblock tags
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Print docblock
- addParam() : DocblockGenerator
- Add a param tag
- addParams() : DocblockGenerator
- Add a param tag
- addTag() : DocblockGenerator
- Add a basic tag
- addTags() : DocblockGenerator
- Add basic tags
- getDesc() : string|null
- Get the docblock description
- getIndent() : int
- Get the indent
- getOutput() : string
- Get the output
- getParam() : array<string|int, mixed>|null
- Get a param
- getReturn() : array<string|int, mixed>|null
- Get the return
- getTag() : string|null
- Get a tag
- getThrows() : array<string|int, mixed>|null
- Get the throws
- hasDesc() : bool
- Has a docblock description
- hasIndent() : bool
- Has indent
- hasOutput() : bool
- Has output
- hasParam() : bool
- Has a param
- hasReturn() : bool
- Has a return
- hasTag() : bool
- Has a tag
- hasThrows() : bool
- Has a throws
- isRendered() : bool
- Is rendered (alias to hasOutput())
- printIndent() : string
- Print the indent
- render() : string
- Render docblock
- setDesc() : DocblockGenerator
- Set the docblock description
- setIndent() : AbstractGenerator
- Set the indent
- setReturn() : DocblockGenerator
- Add a return tag
- setThrows() : DocblockGenerator
- Add a throws tag
- formatTags() : string
- Format the docblock tags
- getParamLength() : int
- Get the longest param type length
- getTagLength() : int
- Get the longest tag length
Properties
$desc
Docblock description
protected
string|null
$desc
= null
$indent
Code indent spaces
protected
int
$indent
= 4
$output
Output string
protected
string|null
$output
= null
$tags
Docblock tags
protected
array<string|int, mixed>
$tags
= ['param' => []]
Methods
__construct()
Constructor
public
__construct([string|null $desc = null ][, int $indent = 4 ]) : mixed
Instantiate the docblock generator object
Parameters
- $desc : string|null = null
- $indent : int = 4
__toString()
Print docblock
public
__toString() : string
Return values
stringaddParam()
Add a param tag
public
addParam([string|null $type = null ][, string|null $var = null ][, string|null $desc = null ]) : DocblockGenerator
Parameters
- $type : string|null = null
- $var : string|null = null
- $desc : string|null = null
Return values
DocblockGeneratoraddParams()
Add a param tag
public
addParams(array<string|int, mixed> $params) : DocblockGenerator
Parameters
- $params : array<string|int, mixed>
Return values
DocblockGeneratoraddTag()
Add a basic tag
public
addTag(string $name[, string|null $desc = null ]) : DocblockGenerator
Parameters
- $name : string
- $desc : string|null = null
Return values
DocblockGeneratoraddTags()
Add basic tags
public
addTags(array<string|int, mixed> $tags) : DocblockGenerator
Parameters
- $tags : array<string|int, mixed>
Return values
DocblockGeneratorgetDesc()
Get the docblock description
public
getDesc() : string|null
Return values
string|nullgetIndent()
Get the indent
public
getIndent() : int
Return values
intgetOutput()
Get the output
public
getOutput() : string
Return values
stringgetParam()
Get a param
public
getParam(int $index) : array<string|int, mixed>|null
Parameters
- $index : int
Return values
array<string|int, mixed>|nullgetReturn()
Get the return
public
getReturn() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetTag()
Get a tag
public
getTag(string $name) : string|null
Parameters
- $name : string
Return values
string|nullgetThrows()
Get the throws
public
getThrows() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullhasDesc()
Has a docblock description
public
hasDesc() : bool
Return values
boolhasIndent()
Has indent
public
hasIndent() : bool
Return values
boolhasOutput()
Has output
public
hasOutput() : bool
Return values
boolhasParam()
Has a param
public
hasParam(int $index) : bool
Parameters
- $index : int
Return values
boolhasReturn()
Has a return
public
hasReturn() : bool
Return values
boolhasTag()
Has a tag
public
hasTag(string $name) : bool
Parameters
- $name : string
Return values
boolhasThrows()
Has a throws
public
hasThrows() : bool
Return values
boolisRendered()
Is rendered (alias to hasOutput())
public
isRendered() : bool
Return values
boolprintIndent()
Print the indent
public
printIndent() : string
Return values
stringrender()
Render docblock
public
render() : string
Return values
stringsetDesc()
Set the docblock description
public
setDesc([string|null $desc = null ]) : DocblockGenerator
Parameters
- $desc : string|null = null
Return values
DocblockGeneratorsetIndent()
Set the indent
public
setIndent(int $indent) : AbstractGenerator
Parameters
- $indent : int
Return values
AbstractGeneratorsetReturn()
Add a return tag
public
setReturn(string $type[, string|null $desc = null ]) : DocblockGenerator
Parameters
- $type : string
- $desc : string|null = null
Return values
DocblockGeneratorsetThrows()
Add a throws tag
public
setThrows(string $type[, string|null $desc = null ]) : DocblockGenerator
Parameters
- $type : string
- $desc : string|null = null
Return values
DocblockGeneratorformatTags()
Format the docblock tags
protected
formatTags() : string
Return values
stringgetParamLength()
Get the longest param type length
protected
getParamLength() : int
Return values
intgetTagLength()
Get the longest tag length
protected
getTagLength() : int