PHP Class Pop\Code\Generator\MethodGenerator

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

Protected Properties

Property Type Description
$abstract boolean Method abstract flag
$arguments array Method arguments
$body string Method body
$docblock DocblockGenerator Docblock generator object
$final boolean Method final flag
$indent string Method indent
$interface boolean Method interface flag
$name string Method name
$output string Method output
$static boolean Method static flag
$visibility string Method visibility

Public Methods

Method Description
__construct ( string $name, string $visibility = 'public', boolean $static = false ) : MethodGenerator Constructor
__toString ( ) : string Print method
addArgument ( string $name, mixed $value = null, string $type = null ) : MethodGenerator Add a method argument
addArguments ( array $args ) : MethodGenerator Add method arguments
addParameter ( string $name, mixed $value = null, string $type = null ) : MethodGenerator Add a method argument (synonym method for convenience)
addParameters ( array $args ) : MethodGenerator Add method arguments (synonym method for convenience)
appendToBody ( string $body, boolean $newline = true ) : MethodGenerator Append to the method body
factory ( string $name, string $visibility = 'public', boolean $static = false ) : MethodGenerator Static method to instantiate the method generator object and return itself to facilitate chaining methods together.
getArgument ( string $name ) : array Get a method argument
getArguments ( ) : array Get the method arguments
getBody ( ) : string Get the method body
getDesc ( ) : string Get the method description
getDocblock ( ) : DocblockGenerator Access the docblock generator object
getIndent ( ) : string Get the method indent
getName ( ) : string Get the method name
getParameter ( string $name ) : array Get a method argument (synonym method for convenience)
getParameters ( ) : array Get the method arguments (synonym method for convenience)
getVisibility ( ) : string Get the method visibility
isAbstract ( ) : boolean Get the method abstract flag
isFinal ( ) : boolean Get the method final flag
isInterface ( ) : boolean Get the method interface flag
isStatic ( ) : boolean Get the method static flag
render ( boolean $ret = false ) : mixed Render method
setAbstract ( boolean $abstract = false ) : MethodGenerator Set the method abstract flag
setBody ( string $body, boolean $newline = true ) : MethodGenerator Set the method body
setDesc ( string $desc = null ) : MethodGenerator Set the method description
setDocblock ( DocblockGenerator $docblock ) : ClassGenerator Set the docblock generator object
setFinal ( boolean $final = false ) : MethodGenerator Set the method final flag
setIndent ( string $indent = null ) : MethodGenerator Set the method indent
setInterface ( boolean $interface = false ) : MethodGenerator Set the method interface flag
setName ( string $name ) : MethodGenerator Set the method name
setStatic ( boolean $static = false ) : MethodGenerator Set the method static flag
setVisibility ( string $visibility = 'public' ) : MethodGenerator Set the method visibility

Protected Methods

Method Description
formatArguments ( ) : string Method to format the arguments

Method Details

__construct() public method

Instantiate the method generator object
public __construct ( string $name, string $visibility = 'public', boolean $static = false ) : MethodGenerator
$name string
$visibility string
$static boolean
return MethodGenerator

__toString() public method

Print method
public __toString ( ) : string
return string

addArgument() public method

Add a method argument
public addArgument ( string $name, mixed $value = null, string $type = null ) : MethodGenerator
$name string
$value mixed
$type string
return MethodGenerator

addArguments() public method

Add method arguments
public addArguments ( array $args ) : MethodGenerator
$args array
return MethodGenerator

addParameter() public method

Add a method argument (synonym method for convenience)
public addParameter ( string $name, mixed $value = null, string $type = null ) : MethodGenerator
$name string
$value mixed
$type string
return MethodGenerator

addParameters() public method

Add method arguments (synonym method for convenience)
public addParameters ( array $args ) : MethodGenerator
$args array
return MethodGenerator

appendToBody() public method

Append to the method body
public appendToBody ( string $body, boolean $newline = true ) : MethodGenerator
$body string
$newline boolean
return MethodGenerator

factory() public static method

Static method to instantiate the method generator object and return itself to facilitate chaining methods together.
public static factory ( string $name, string $visibility = 'public', boolean $static = false ) : MethodGenerator
$name string
$visibility string
$static boolean
return MethodGenerator

formatArguments() protected method

Method to format the arguments
protected formatArguments ( ) : string
return string

getArgument() public method

Get a method argument
public getArgument ( string $name ) : array
$name string
return array

getArguments() public method

Get the method arguments
public getArguments ( ) : array
return array

getBody() public method

Get the method body
public getBody ( ) : string
return string

getDesc() public method

Get the method description
public getDesc ( ) : string
return string

getDocblock() public method

Access the docblock generator object
public getDocblock ( ) : DocblockGenerator
return DocblockGenerator

getIndent() public method

Get the method indent
public getIndent ( ) : string
return string

getName() public method

Get the method name
public getName ( ) : string
return string

getParameter() public method

Get a method argument (synonym method for convenience)
public getParameter ( string $name ) : array
$name string
return array

getParameters() public method

Get the method arguments (synonym method for convenience)
public getParameters ( ) : array
return array

getVisibility() public method

Get the method visibility
public getVisibility ( ) : string
return string

isAbstract() public method

Get the method abstract flag
public isAbstract ( ) : boolean
return boolean

isFinal() public method

Get the method final flag
public isFinal ( ) : boolean
return boolean

isInterface() public method

Get the method interface flag
public isInterface ( ) : boolean
return boolean

isStatic() public method

Get the method static flag
public isStatic ( ) : boolean
return boolean

render() public method

Render method
public render ( boolean $ret = false ) : mixed
$ret boolean
return mixed

setAbstract() public method

Set the method abstract flag
public setAbstract ( boolean $abstract = false ) : MethodGenerator
$abstract boolean
return MethodGenerator

setBody() public method

Set the method body
public setBody ( string $body, boolean $newline = true ) : MethodGenerator
$body string
$newline boolean
return MethodGenerator

setDesc() public method

Set the method description
public setDesc ( string $desc = null ) : MethodGenerator
$desc string
return MethodGenerator

setDocblock() public method

Set the docblock generator object
public setDocblock ( DocblockGenerator $docblock ) : ClassGenerator
$docblock DocblockGenerator
return ClassGenerator

setFinal() public method

Set the method final flag
public setFinal ( boolean $final = false ) : MethodGenerator
$final boolean
return MethodGenerator

setIndent() public method

Set the method indent
public setIndent ( string $indent = null ) : MethodGenerator
$indent string
return MethodGenerator

setInterface() public method

Set the method interface flag
public setInterface ( boolean $interface = false ) : MethodGenerator
$interface boolean
return MethodGenerator

setName() public method

Set the method name
public setName ( string $name ) : MethodGenerator
$name string
return MethodGenerator

setStatic() public method

Set the method static flag
public setStatic ( boolean $static = false ) : MethodGenerator
$static boolean
return MethodGenerator

setVisibility() public method

Set the method visibility
public setVisibility ( string $visibility = 'public' ) : MethodGenerator
$visibility string
return MethodGenerator

Property Details

$abstract protected_oe property

Method abstract flag
protected bool $abstract
return boolean

$arguments protected_oe property

Method arguments
protected array $arguments
return array

$body protected_oe property

Method body
protected string $body
return string

$docblock protected_oe property

Docblock generator object
protected DocblockGenerator,Pop\Code\Generator $docblock
return DocblockGenerator

$final protected_oe property

Method final flag
protected bool $final
return boolean

$indent protected_oe property

Method indent
protected string $indent
return string

$interface protected_oe property

Method interface flag
protected bool $interface
return boolean

$name protected_oe property

Method name
protected string $name
return string

$output protected_oe property

Method output
protected string $output
return string

$static protected_oe property

Method static flag
protected bool $static
return boolean

$visibility protected_oe property

Method visibility
protected string $visibility
return string