BodyGenerator
extends AbstractGenerator
in package
Uses
DocblockTrait, BodyTrait
Body generator class
Tags
Table of Contents
Properties
- $body : string|null
- Function body
- $docblock : DocblockGenerator|null
- Docblock generator object
- $indent : int
- Code indent spaces
- $output : string|null
- Output string
Methods
- __toString() : string
- Print function
- appendToBody() : static
- Append to the function body
- createReturnConfig() : BodyGenerator
- Create return config
- getBody() : string|null
- Get the function body
- getDesc() : string|null
- Get the docblock description
- getDocblock() : DocblockGenerator|null
- Access the docblock generator object
- getIndent() : int
- Get the indent
- getOutput() : string
- Get the output
- hasBody() : bool
- Has method body
- hasDesc() : bool
- Has a docblock description
- hasDocblock() : bool
- Has docblock generator object
- hasIndent() : bool
- Has indent
- hasOutput() : bool
- Has output
- indentBody() : static
- Append to the function body
- isRendered() : bool
- Is rendered (alias to hasOutput())
- printIndent() : string
- Print the indent
- render() : string
- Render body
- setBody() : static
- Set the function body
- setDesc() : static
- Set the docblock description
- setDocblock() : static
- Set the docblock generator object
- setIndent() : AbstractGenerator
- Set the indent
Properties
$body
Function body
protected
string|null
$body
= null
$docblock
Docblock generator object
protected
DocblockGenerator|null
$docblock
= null
$indent
Code indent spaces
protected
int
$indent
= 4
$output
Output string
protected
string|null
$output
= null
Methods
__toString()
Print function
public
__toString() : string
Return values
stringappendToBody()
Append to the function body
public
appendToBody(string $body) : static
Parameters
- $body : string
Return values
staticcreateReturnConfig()
Create return config
public
createReturnConfig(array<string|int, mixed> $config[, int $indent = 4 ]) : BodyGenerator
Parameters
- $config : array<string|int, mixed>
- $indent : int = 4
Return values
BodyGeneratorgetBody()
Get the function body
public
getBody() : string|null
Return values
string|nullgetDesc()
Get the docblock description
public
getDesc() : string|null
Return values
string|nullgetDocblock()
Access the docblock generator object
public
getDocblock() : DocblockGenerator|null
Return values
DocblockGenerator|nullgetIndent()
Get the indent
public
getIndent() : int
Return values
intgetOutput()
Get the output
public
getOutput() : string
Return values
stringhasBody()
Has method body
public
hasBody() : bool
Return values
boolhasDesc()
Has a docblock description
public
hasDesc() : bool
Return values
boolhasDocblock()
Has docblock generator object
public
hasDocblock() : bool
Return values
boolhasIndent()
Has indent
public
hasIndent() : bool
Return values
boolhasOutput()
Has output
public
hasOutput() : bool
Return values
boolindentBody()
Append to the function body
public
indentBody(int $indent) : static
Parameters
- $indent : int
Return values
staticisRendered()
Is rendered (alias to hasOutput())
public
isRendered() : bool
Return values
boolprintIndent()
Print the indent
public
printIndent() : string
Return values
stringrender()
Render body
public
render() : string
Return values
stringsetBody()
Set the function body
public
setBody(string $body[, int $indent = 4 ]) : static
Parameters
- $body : string
- $indent : int = 4
Return values
staticsetDesc()
Set the docblock description
public
setDesc([string|null $desc = null ]) : static
Parameters
- $desc : string|null = null
Return values
staticsetDocblock()
Set the docblock generator object
public
setDocblock(DocblockGenerator $docblock) : static
Parameters
- $docblock : DocblockGenerator
Return values
staticsetIndent()
Set the indent
public
setIndent(int $indent) : AbstractGenerator
Parameters
- $indent : int