Documentation

FunctionGenerator extends AbstractGenerator
in package
Uses NameTrait, DocblockTrait, FunctionTrait, BodyTrait

Function generator class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2021 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.1.0

Table of Contents

$arguments  : array<string|int, mixed>
Arguments
$body  : string
Function body
$closure  : bool
Function interface flag
$docblock  : DocblockGenerator
Docblock generator object
$indent  : int
Function indent
$name  : string
Name
$output  : string
Output string
__construct()  : mixed
Constructor
__toString()  : string
Print function
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)
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
isClosure()  : bool
Get the function closure flag
isRendered()  : bool
Is rendered (alias to hasOutput())
printIndent()  : string
Print the indent
render()  : string
Render function
setAsClosure()  : FunctionGenerator
Set the function closure 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
formatArguments()  : string
Format the arguments

Properties

$arguments

Arguments

protected array<string|int, mixed> $arguments = []

Methods

__construct()

Constructor

public __construct([string $name = null ][, bool $closure = false ]) : mixed

Instantiate the function generator object

Parameters
$name : string = null
$closure : bool = false
Return values
mixed

__toString()

Print function

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

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

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>

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

hasName()

Get the name

public hasName() : 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

isClosure()

Get the function closure flag

public isClosure() : bool
Return values
bool

isRendered()

Is rendered (alias to hasOutput())

public isRendered() : bool
Return values
bool

printIndent()

Print the indent

public printIndent() : string
Return values
string

setBody()

Set the function body

public setBody(string $body[, int $indent = 4 ]) : BodyTrait
Parameters
$body : string
$indent : int = 4
Return values
BodyTrait

formatArguments()

Format the arguments

protected formatArguments() : string
Return values
string

Search results