MethodGenerator
extends AbstractClassElementGenerator
in package
Uses
NameTrait, DocblockTrait, AbstractFinalTrait, FunctionTrait, BodyTrait
Namespace generator class
Tags
Table of Contents
- $abstract : bool
- Method abstract flag
- $arguments : array<string|int, mixed>
- Arguments
- $body : string
- Method body
- $docblock : DocblockGenerator
- Docblock generator object
- $final : bool
- Method final flag
- $indent : int
- Code indent spaces
- $name : string
- Name
- $output : string
- Output string
- $static : bool
- Static flag
- $visibility : string
- Visibility
- __construct() : mixed
- Constructor
- __toString() : string
- Print method
- addArgument() : FunctionTrait
- Add an argument
- addArguments() : FunctionTrait
- Add arguments
- addParameter() : FunctionTrait
- Add an argument (alias method for convenience)
- addParameters() : FunctionTrait
- Add arguments (alias method for convenience)
- appendToBody() : BodyTrait
- Append to the function body
- getArgument() : array<string|int, mixed>
- Get an argument
- getArguments() : array<string|int, mixed>
- Get the arguments
- getBody() : string
- Get the function body
- getDesc() : string
- Get the docblock description
- getDocblock() : DocblockGenerator
- Access the docblock generator object
- getIndent() : int
- Get the indent
- getName() : string
- Get the name
- getOutput() : string
- Get the output
- getParameter() : array<string|int, mixed>
- Get an argument (alias method for convenience)
- getParameters() : array<string|int, mixed>
- Get the arguments (alias method for convenience)
- getVisibility() : string
- Get the visibility
- hasArgument() : bool
- Has an argument
- hasArguments() : bool
- Has arguments
- hasBody() : bool
- Has method body
- hasDesc() : bool
- Has a docblock description
- hasDocblock() : bool
- Has docblock generator object
- hasIndent() : bool
- Has indent
- hasName() : bool
- Get the name
- hasOutput() : bool
- Has output
- hasParameter() : bool
- Has an argument (alias method for convenience)
- hasParameters() : bool
- Has arguments (alias method for convenience)
- indentBody() : BodyTrait
- Append to the function body
- isAbstract() : bool
- Get the method abstract flag
- isFinal() : bool
- Get the method final flag
- isPrivate() : bool
- Set the visibility to private
- isProtected() : bool
- Set the visibility to protected
- isPublic() : bool
- Is visibility public
- isRendered() : bool
- Is rendered (alias to hasOutput())
- isStatic() : bool
- Get the static flag
- printIndent() : string
- Print the indent
- render() : string
- Render method
- setAsAbstract() : AbstractFinalTrait
- Set the method abstract flag
- setAsFinal() : AbstractFinalTrait
- Set the method final flag
- setAsPrivate() : AbstractClassElementGenerator
- Set the visibility to public
- setAsProtected() : AbstractClassElementGenerator
- Set the visibility to protected
- setAsPublic() : AbstractClassElementGenerator
- Set the visibility to public
- setAsStatic() : AbstractClassElementGenerator
- Set the static flag
- setBody() : BodyTrait
- Set the function body
- setDesc() : DocblockTrait
- Set the docblock description
- setDocblock() : DocblockTrait
- Set the docblock generator object
- setIndent() : AbstractGenerator
- Set the indent
- setName() : NameTrait
- Set the name
- setVisibility() : AbstractClassElementGenerator
- Set the visibility
- formatArguments() : string
- Format the arguments
Properties
$abstract
Method abstract flag
protected
bool
$abstract
= false
$arguments
Arguments
protected
array<string|int, mixed>
$arguments
= []
$body
Method body
protected
string
$body
= null
$docblock
Docblock generator object
protected
DocblockGenerator
$docblock
= null
$final
Method final flag
protected
bool
$final
= false
$indent
Code indent spaces
protected
int
$indent
= 4
$name
Name
protected
string
$name
= null
$output
Output string
protected
string
$output
= null
$static
Static flag
protected
bool
$static
= false
$visibility
Visibility
protected
string
$visibility
= 'public'
Methods
__construct()
Constructor
public
__construct(string $name[, string $visibility = 'public' ][, bool $static = false ]) : mixed
Instantiate the method generator object
Parameters
- $name : string
- $visibility : string = 'public'
- $static : bool = false
Return values
mixed —__toString()
Print method
public
__toString() : string
Return values
string —addArgument()
Add an argument
public
addArgument(string $name[, mixed $value = null ][, string $type = null ]) : FunctionTrait
Parameters
- $name : string
- $value : mixed = null
- $type : string = null
Return values
FunctionTrait —addArguments()
Add arguments
public
addArguments(array<string|int, mixed> $args) : FunctionTrait
Parameters
- $args : array<string|int, mixed>
Return values
FunctionTrait —addParameter()
Add an argument (alias method for convenience)
public
addParameter(string $name[, mixed $value = null ][, string $type = null ]) : FunctionTrait
Parameters
- $name : string
- $value : mixed = null
- $type : string = null
Return values
FunctionTrait —addParameters()
Add arguments (alias method for convenience)
public
addParameters(array<string|int, mixed> $args) : FunctionTrait
Parameters
- $args : array<string|int, mixed>
Return values
FunctionTrait —appendToBody()
Append to the function body
public
appendToBody(string $body) : BodyTrait
Parameters
- $body : string
Return values
BodyTrait —getArgument()
Get an argument
public
getArgument(string $name) : array<string|int, mixed>
Parameters
- $name : string
Return values
array<string|int, mixed> —getArguments()
Get the arguments
public
getArguments() : array<string|int, mixed>
Return values
array<string|int, mixed> —getBody()
Get the function body
public
getBody() : string
Return values
string —getDesc()
Get the docblock description
public
getDesc() : string
Return values
string —getDocblock()
Access the docblock generator object
public
getDocblock() : DocblockGenerator
Return values
DocblockGenerator —getIndent()
Get the indent
public
getIndent() : int
Return values
int —getName()
Get the name
public
getName() : string
Return values
string —getOutput()
Get the output
public
getOutput() : string
Return values
string —getParameter()
Get an argument (alias method for convenience)
public
getParameter(string $name) : array<string|int, mixed>
Parameters
- $name : string
Return values
array<string|int, mixed> —getParameters()
Get the arguments (alias method for convenience)
public
getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed> —getVisibility()
Get the visibility
public
getVisibility() : string
Return values
string —hasArgument()
Has an argument
public
hasArgument(string $name) : bool
Parameters
- $name : string
Return values
bool —hasArguments()
Has arguments
public
hasArguments() : bool
Return values
bool —hasBody()
Has method body
public
hasBody() : bool
Return values
bool —hasDesc()
Has a docblock description
public
hasDesc() : bool
Return values
bool —hasDocblock()
Has docblock generator object
public
hasDocblock() : bool
Return values
bool —hasIndent()
Has indent
public
hasIndent() : bool
Return values
bool —hasName()
Get the name
public
hasName() : bool
Return values
bool —hasOutput()
Has output
public
hasOutput() : bool
Return values
bool —hasParameter()
Has an argument (alias method for convenience)
public
hasParameter(string $name) : bool
Parameters
- $name : string
Return values
bool —hasParameters()
Has arguments (alias method for convenience)
public
hasParameters() : bool
Return values
bool —indentBody()
Append to the function body
public
indentBody(int $indent) : BodyTrait
Parameters
- $indent : int
Return values
BodyTrait —isAbstract()
Get the method abstract flag
public
isAbstract() : bool
Return values
bool —isFinal()
Get the method final flag
public
isFinal() : bool
Return values
bool —isPrivate()
Set the visibility to private
public
isPrivate() : bool
Return values
bool —isProtected()
Set the visibility to protected
public
isProtected() : bool
Return values
bool —isPublic()
Is visibility public
public
isPublic() : bool
Return values
bool —isRendered()
Is rendered (alias to hasOutput())
public
isRendered() : bool
Return values
bool —isStatic()
Get the static flag
public
isStatic() : bool
Return values
bool —printIndent()
Print the indent
public
printIndent() : string
Return values
string —render()
Render method
public
render() : string
Return values
string —setAsAbstract()
Set the method abstract flag
public
setAsAbstract([bool $abstract = true ]) : AbstractFinalTrait
Parameters
- $abstract : bool = true
Return values
AbstractFinalTrait —setAsFinal()
Set the method final flag
public
setAsFinal([bool $final = true ]) : AbstractFinalTrait
Parameters
- $final : bool = true
Return values
AbstractFinalTrait —setAsPrivate()
Set the visibility to public
public
setAsPrivate() : AbstractClassElementGenerator
Return values
AbstractClassElementGenerator —setAsProtected()
Set the visibility to protected
public
setAsProtected() : AbstractClassElementGenerator
Return values
AbstractClassElementGenerator —setAsPublic()
Set the visibility to public
public
setAsPublic() : AbstractClassElementGenerator
Return values
AbstractClassElementGenerator —setAsStatic()
Set the static flag
public
setAsStatic([bool $static = true ]) : AbstractClassElementGenerator
Parameters
- $static : bool = true
Return values
AbstractClassElementGenerator —setBody()
Set the function body
public
setBody(string $body[, int $indent = 4 ]) : BodyTrait
Parameters
- $body : string
- $indent : int = 4
Return values
BodyTrait —setDesc()
Set the docblock description
public
setDesc([string $desc = null ]) : DocblockTrait
Parameters
- $desc : string = null
Return values
DocblockTrait —setDocblock()
Set the docblock generator object
public
setDocblock(DocblockGenerator $docblock) : DocblockTrait
Parameters
- $docblock : DocblockGenerator
Return values
DocblockTrait —setIndent()
Set the indent
public
setIndent(string $indent) : AbstractGenerator
Parameters
- $indent : string
Return values
AbstractGenerator —setName()
Set the name
public
setName(string $name) : NameTrait
Parameters
- $name : string
Return values
NameTrait —setVisibility()
Set the visibility
public
setVisibility([string $visibility = 'public' ]) : AbstractClassElementGenerator
Parameters
- $visibility : string = 'public'
Return values
AbstractClassElementGenerator —formatArguments()
Format the arguments
protected
formatArguments() : string