PHP Class Pop\Code\Generator\FunctionGenerator

Author: Nick Sagona, III ([email protected])
Afficher le fichier Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Свойство Type Description
$arguments array Function arguments
$body string Function body
$closure boolean Function interface flag
$docblock DocblockGenerator Docblock generator object
$indent string Function indent
$name string Function name
$output string Function output

Méthodes publiques

Méthode Description
__construct ( string $name, mixed $func = null ) : FunctionGenerator Constructor
__toString ( ) : string Print method
addArgument ( string $name, mixed $value = null, string $type = null ) : FunctionGenerator Add a function argument
addArguments ( array $args ) : FunctionGenerator Add function arguments
addParameter ( string $name, mixed $value = null, string $type = null ) : FunctionGenerator Add a function argument (synonym method for convenience)
addParameters ( array $args ) : FunctionGenerator Add function arguments (synonym method for convenience)
appendToBody ( string $body, boolean $newline = true ) : FunctionGenerator Append to the function body
factory ( string $name, mixed $func = null ) : FunctionGenerator Static method to instantiate the function generator object and return itself to facilitate chaining methods together.
getArgument ( string $name ) : array Get a function argument
getArgumentNames ( ) : array Get the function arguments
getArguments ( ) : array Get the function arguments
getBody ( ) : string Get the function body
getDesc ( ) : string Get the function description
getDocblock ( ) : DocblockGenerator Access the docblock generator object
getIndent ( ) : string Get the function indent
getName ( ) : string Get the function name
getParameter ( string $name ) : array Get a function argument (synonym method for convenience)
getParameterNames ( ) : array Get the function arguments (synonym method for convenience)
getParameters ( ) : array Get the function arguments (synonym method for convenience)
isClosure ( ) : boolean Get the function closure flag
render ( boolean $ret = false ) : mixed Render method
setBody ( string $body, boolean $newline = true ) : FunctionGenerator Set the function body
setClosure ( boolean $closure = false ) : FunctionGenerator Set the function closure flag
setDesc ( string $desc = null ) : FunctionGenerator Set the function description
setDocblock ( DocblockGenerator $docblock ) : ClassGenerator Set the docblock generator object
setIndent ( string $indent = null ) : FunctionGenerator Set the function indent
setName ( string $name ) : FunctionGenerator Set the function name

Méthodes protégées

Méthode Description
formatArguments ( ) : string Method to format the arguments
parseFunction ( mixed $func ) : void Method to format the arguments

Method Details

__construct() public méthode

Instantiate the function generator object
public __construct ( string $name, mixed $func = null ) : FunctionGenerator
$name string
$func mixed
Résultat FunctionGenerator

__toString() public méthode

Print method
public __toString ( ) : string
Résultat string

addArgument() public méthode

Add a function argument
public addArgument ( string $name, mixed $value = null, string $type = null ) : FunctionGenerator
$name string
$value mixed
$type string
Résultat FunctionGenerator

addArguments() public méthode

Add function arguments
public addArguments ( array $args ) : FunctionGenerator
$args array
Résultat FunctionGenerator

addParameter() public méthode

Add a function argument (synonym method for convenience)
public addParameter ( string $name, mixed $value = null, string $type = null ) : FunctionGenerator
$name string
$value mixed
$type string
Résultat FunctionGenerator

addParameters() public méthode

Add function arguments (synonym method for convenience)
public addParameters ( array $args ) : FunctionGenerator
$args array
Résultat FunctionGenerator

appendToBody() public méthode

Append to the function body
public appendToBody ( string $body, boolean $newline = true ) : FunctionGenerator
$body string
$newline boolean
Résultat FunctionGenerator

factory() public static méthode

Static method to instantiate the function generator object and return itself to facilitate chaining methods together.
public static factory ( string $name, mixed $func = null ) : FunctionGenerator
$name string
$func mixed
Résultat FunctionGenerator

formatArguments() protected méthode

Method to format the arguments
protected formatArguments ( ) : string
Résultat string

getArgument() public méthode

Get a function argument
public getArgument ( string $name ) : array
$name string
Résultat array

getArgumentNames() public méthode

Get the function arguments
public getArgumentNames ( ) : array
Résultat array

getArguments() public méthode

Get the function arguments
public getArguments ( ) : array
Résultat array

getBody() public méthode

Get the function body
public getBody ( ) : string
Résultat string

getDesc() public méthode

Get the function description
public getDesc ( ) : string
Résultat string

getDocblock() public méthode

Access the docblock generator object
public getDocblock ( ) : DocblockGenerator
Résultat DocblockGenerator

getIndent() public méthode

Get the function indent
public getIndent ( ) : string
Résultat string

getName() public méthode

Get the function name
public getName ( ) : string
Résultat string

getParameter() public méthode

Get a function argument (synonym method for convenience)
public getParameter ( string $name ) : array
$name string
Résultat array

getParameterNames() public méthode

Get the function arguments (synonym method for convenience)
public getParameterNames ( ) : array
Résultat array

getParameters() public méthode

Get the function arguments (synonym method for convenience)
public getParameters ( ) : array
Résultat array

isClosure() public méthode

Get the function closure flag
public isClosure ( ) : boolean
Résultat boolean

parseFunction() protected méthode

Method to format the arguments
protected parseFunction ( mixed $func ) : void
$func mixed
Résultat void

render() public méthode

Render method
public render ( boolean $ret = false ) : mixed
$ret boolean
Résultat mixed

setBody() public méthode

Set the function body
public setBody ( string $body, boolean $newline = true ) : FunctionGenerator
$body string
$newline boolean
Résultat FunctionGenerator

setClosure() public méthode

Set the function closure flag
public setClosure ( boolean $closure = false ) : FunctionGenerator
$closure boolean
Résultat FunctionGenerator

setDesc() public méthode

Set the function description
public setDesc ( string $desc = null ) : FunctionGenerator
$desc string
Résultat FunctionGenerator

setDocblock() public méthode

Set the docblock generator object
public setDocblock ( DocblockGenerator $docblock ) : ClassGenerator
$docblock DocblockGenerator
Résultat ClassGenerator

setIndent() public méthode

Set the function indent
public setIndent ( string $indent = null ) : FunctionGenerator
$indent string
Résultat FunctionGenerator

setName() public méthode

Set the function name
public setName ( string $name ) : FunctionGenerator
$name string
Résultat FunctionGenerator

Property Details

$arguments protected_oe property

Function arguments
protected array $arguments
Résultat array

$body protected_oe property

Function body
protected string $body
Résultat string

$closure protected_oe property

Function interface flag
protected bool $closure
Résultat boolean

$docblock protected_oe property

Docblock generator object
protected DocblockGenerator,Pop\Code\Generator $docblock
Résultat DocblockGenerator

$indent protected_oe property

Function indent
protected string $indent
Résultat string

$name protected_oe property

Function name
protected string $name
Résultat string

$output protected_oe property

Function output
protected string $output
Résultat string