PHP Class Zend\Code\Generator\ParameterGenerator

Inheritance: extends Zend\Code\Generator\AbstractGenerator
ファイルを表示 Open project: zendframework/zend-code Class Usage Examples

Protected Properties

Property Type Description
$defaultValue string | ValueGenerator
$name string
$passedByReference boolean
$position integer
$type TypeGenerator | null

Public Methods

Method Description
__construct ( string $name = null, string $type = null, mixed $defaultValue = null, integer $position = null, boolean $passByReference = false )
fromArray ( array $array ) : ParameterGenerator Generate from array
fromReflection ( Zend\Code\Reflection\ParameterReflection $reflectionParameter ) : ParameterGenerator
generate ( ) : string
getDefaultValue ( ) : string
getName ( ) : string
getPassedByReference ( ) : boolean
getPosition ( ) : integer
getType ( ) : string
getVariadic ( ) : boolean
setDefaultValue ( null | boolean | string | integer | float | array | ValueGenerator $defaultValue ) : ParameterGenerator Set the default value of the parameter.
setName ( string $name ) : ParameterGenerator
setPassedByReference ( boolean $passedByReference ) : ParameterGenerator
setPosition ( integer $position ) : ParameterGenerator
setType ( string $type ) : ParameterGenerator
setVariadic ( boolean $variadic ) : ParameterGenerator

Private Methods

Method Description
expandLiteralParameterType ( string $literalParameterType, ReflectionParameter $reflectionParameter ) : string
extractFQCNTypeFromReflectionType ( Zend\Code\Reflection\ParameterReflection $reflectionParameter ) : null | string
generateTypeHint ( ) : string
prePhp7ExtractFQCNTypeFromReflectionType ( Zend\Code\Reflection\ParameterReflection $reflectionParameter ) : string | null For ancient PHP versions (yes, you should upgrade to 7.0):

Method Details

__construct() public method

public __construct ( string $name = null, string $type = null, mixed $defaultValue = null, integer $position = null, boolean $passByReference = false )
$name string
$type string
$defaultValue mixed
$position integer
$passByReference boolean

fromArray() public static method

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

fromReflection() public static method

public static fromReflection ( Zend\Code\Reflection\ParameterReflection $reflectionParameter ) : ParameterGenerator
$reflectionParameter Zend\Code\Reflection\ParameterReflection
return ParameterGenerator

generate() public method

public generate ( ) : string
return string

getDefaultValue() public method

public getDefaultValue ( ) : string
return string

getName() public method

public getName ( ) : string
return string

getPassedByReference() public method

public getPassedByReference ( ) : boolean
return boolean

getPosition() public method

public getPosition ( ) : integer
return integer

getType() public method

public getType ( ) : string
return string

getVariadic() public method

public getVariadic ( ) : boolean
return boolean

setDefaultValue() public method

Certain variables are difficult to express
public setDefaultValue ( null | boolean | string | integer | float | array | ValueGenerator $defaultValue ) : ParameterGenerator
$defaultValue null | boolean | string | integer | float | array | ValueGenerator
return ParameterGenerator

setName() public method

public setName ( string $name ) : ParameterGenerator
$name string
return ParameterGenerator

setPassedByReference() public method

public setPassedByReference ( boolean $passedByReference ) : ParameterGenerator
$passedByReference boolean
return ParameterGenerator

setPosition() public method

public setPosition ( integer $position ) : ParameterGenerator
$position integer
return ParameterGenerator

setType() public method

public setType ( string $type ) : ParameterGenerator
$type string
return ParameterGenerator

setVariadic() public method

public setVariadic ( boolean $variadic ) : ParameterGenerator
$variadic boolean
return ParameterGenerator

Property Details

$defaultValue protected_oe property

protected string|ValueGenerator,Zend\Code\Generator $defaultValue
return string | ValueGenerator

$name protected_oe property

protected string $name
return string

$passedByReference protected_oe property

protected bool $passedByReference
return boolean

$position protected_oe property

protected int $position
return integer

$type protected_oe property

protected TypeGenerator,Zend\Code\Generator|null $type
return TypeGenerator | null