PHP Class Zend\Code\Generator\MethodGenerator

Inheritance: extends Zend\Code\Generator\AbstractMemberGenerator
Mostrar archivo Open project: zendframework/zend-code Class Usage Examples

Protected Properties

Property Type Description
$body string
$docBlock Zend\Code\Generator\DocBlockGenerator
$parameters ParameterGenerator[]

Public Methods

Method Description
__construct ( string $name = null, array $parameters = [], integer $flags = self::FLAG_PUBLIC, string $body = null, Zend\Code\Generator\DocBlockGenerator | string $docBlock = null )
__toString ( )
fromArray ( array $array ) : MethodGenerator Generate from array
fromReflection ( Zend\Code\Reflection\MethodReflection $reflectionMethod ) : MethodGenerator
generate ( ) : string
getBody ( ) : string
getParameters ( ) : ParameterGenerator[]
getReturnType ( ) : TypeGenerator | null
setBody ( string $body ) : MethodGenerator
setParameter ( ParameterGenerator | array | string $parameter ) : MethodGenerator
setParameters ( array $parameters ) : MethodGenerator
setReturnType ( $returnType = null ) : MethodGenerator
setReturnsReference ( boolean $returnsReference ) : MethodGenerator

Protected Methods

Method Description
clearBodyIndention ( string $body ) : string Identify the space indention from the first line and remove this indention from all lines

Private Methods

Method Description
expandLiteralType ( string $literalReturnType, ReflectionMethod $methodReflection ) : string
extractReturnTypeFromMethodReflection ( Zend\Code\Reflection\MethodReflection $methodReflection ) : null | string

Method Details

__construct() public method

public __construct ( string $name = null, array $parameters = [], integer $flags = self::FLAG_PUBLIC, string $body = null, Zend\Code\Generator\DocBlockGenerator | string $docBlock = null )
$name string
$parameters array
$flags integer
$body string
$docBlock Zend\Code\Generator\DocBlockGenerator | string

__toString() public method

public __toString ( )

clearBodyIndention() protected static method

Identify the space indention from the first line and remove this indention from all lines
protected static clearBodyIndention ( string $body ) : string
$body string
return string

fromArray() public static method

Generate from array
public static fromArray ( array $array ) : MethodGenerator
$array array
return MethodGenerator

fromReflection() public static method

public static fromReflection ( Zend\Code\Reflection\MethodReflection $reflectionMethod ) : MethodGenerator
$reflectionMethod Zend\Code\Reflection\MethodReflection
return MethodGenerator

generate() public method

public generate ( ) : string
return string

getBody() public method

public getBody ( ) : string
return string

getParameters() public method

public getParameters ( ) : ParameterGenerator[]
return ParameterGenerator[]

getReturnType() public method

public getReturnType ( ) : TypeGenerator | null
return TypeGenerator | null

setBody() public method

public setBody ( string $body ) : MethodGenerator
$body string
return MethodGenerator

setParameter() public method

public setParameter ( ParameterGenerator | array | string $parameter ) : MethodGenerator
$parameter ParameterGenerator | array | string
return MethodGenerator

setParameters() public method

public setParameters ( array $parameters ) : MethodGenerator
$parameters array
return MethodGenerator

setReturnType() public method

public setReturnType ( $returnType = null ) : MethodGenerator
return MethodGenerator

setReturnsReference() public method

public setReturnsReference ( boolean $returnsReference ) : MethodGenerator
$returnsReference boolean
return MethodGenerator

Property Details

$body protected_oe property

protected string $body
return string

$docBlock protected_oe property

protected DocBlockGenerator,Zend\Code\Generator $docBlock
return Zend\Code\Generator\DocBlockGenerator

$parameters protected_oe property

protected ParameterGenerator[],Zend\Code\Generator $parameters
return ParameterGenerator[]