PHP Class Zend\Code\Generator\MethodGenerator

Inheritance: extends Zend\Code\Generator\AbstractMemberGenerator
Afficher le fichier Open project: zendframework/zend-code Class Usage Examples

Protected Properties

Свойство Type Description
$body string
$docBlock Zend\Code\Generator\DocBlockGenerator
$parameters ParameterGenerator[]

Méthodes publiques

Méthode 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

Méthodes protégées

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

Private Methods

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

Method Details

__construct() public méthode

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 méthode

public __toString ( )

clearBodyIndention() protected static méthode

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

fromArray() public static méthode

Generate from array
public static fromArray ( array $array ) : MethodGenerator
$array array
Résultat MethodGenerator

fromReflection() public static méthode

public static fromReflection ( Zend\Code\Reflection\MethodReflection $reflectionMethod ) : MethodGenerator
$reflectionMethod Zend\Code\Reflection\MethodReflection
Résultat MethodGenerator

generate() public méthode

public generate ( ) : string
Résultat string

getBody() public méthode

public getBody ( ) : string
Résultat string

getParameters() public méthode

public getParameters ( ) : ParameterGenerator[]
Résultat ParameterGenerator[]

getReturnType() public méthode

public getReturnType ( ) : TypeGenerator | null
Résultat TypeGenerator | null

setBody() public méthode

public setBody ( string $body ) : MethodGenerator
$body string
Résultat MethodGenerator

setParameter() public méthode

public setParameter ( ParameterGenerator | array | string $parameter ) : MethodGenerator
$parameter ParameterGenerator | array | string
Résultat MethodGenerator

setParameters() public méthode

public setParameters ( array $parameters ) : MethodGenerator
$parameters array
Résultat MethodGenerator

setReturnType() public méthode

public setReturnType ( $returnType = null ) : MethodGenerator
Résultat MethodGenerator

setReturnsReference() public méthode

public setReturnsReference ( boolean $returnsReference ) : MethodGenerator
$returnsReference boolean
Résultat MethodGenerator

Property Details

$body protected_oe property

protected string $body
Résultat string

$docBlock protected_oe property

protected DocBlockGenerator,Zend\Code\Generator $docBlock
Résultat Zend\Code\Generator\DocBlockGenerator

$parameters protected_oe property

protected ParameterGenerator[],Zend\Code\Generator $parameters
Résultat ParameterGenerator[]