Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcReflectionParameter

Reflection::ezcReflectionParameter

Class ezcReflectionParameter

The ezcReflectionParameter class retrieves information about a function's or method's parameters and their types.

Extends the ReflectionParameter class to provide type information using PHPDoc annotations.

Source for this file: /Reflection/src/parameter.php

ReflectionParameter
   |
   --ezcReflectionParameter
Version:   //autogen//

Member Variables

protected ReflectionParameter $parameter = null
ReflectionParameter instance if one was provided to the constructor
protected integer|string|ReflectionParameter $reflectionSource
protected ezcReflectionType $type
Type of the parameter

Inherited Member Variables

From ReflectionParameter (Internal Class)
public $name

Method Summary

public static mixed export( $function , $parameter , [ $return = false] )
Exports a reflection object.
public ezcReflectionParameter __construct( $functionOrMethod , $parameterPositionNameOrSource , [ $type = null] , $parameter )
Constructor
public boolean allowsNull( )
Returns whether NULL is allowed as this parameters's value
protected mixed forwardCallToReflectionSource( $method , [ $arguments = array()] )
Forwards a method invocation to either the reflection source passed to the constructor of this class when creating an instance or to the parent class.
public ezcReflectionClass|NULL getClass( )
Returns reflection object identified by type hinting or NULL if there is no hint
public ezcReflectionClass getDeclaringClass( )
Returns in which class this parameter is defined (not the type hint of the parameter)
public ezcReflectionFunction|ezcReflectionMethod getDeclaringFunction( )
Returns the function or method declaring this parameter
public mixed getDefaultValue( )
Returns the default value of this parameter or throws an exception
public string getName( )
Returns this parameters's name
public integer getPosition( )
Returns whether this parameter is an optional parameter
public ezcReflectionType getType( )
Returns the type of this parameter in form of an ezcReflectionType
public boolean isArray( )
Returns whether parameter MUST be an array
public boolean isDefaultValueAvailable( )
Returns whether the default value of this parameter is available
public boolean isOptional( )
Returns whether this parameter is an optional parameter
public boolean isPassedByReference( )
Returns whether this parameters is passed to by reference
public mixed __call( $method , $arguments )
Use overloading to call additional methods of the ReflectionParameter instance given to the constructor.
public string __toString( )
Returns a string representation

Inherited Methods

From ReflectionParameter (Internal Class)
public ReflectionParameter constructor __construct ( $function, $parameter )
public void allowsNull ( )
public void export ( $function, $parameter, [$return = ] )
public void getClass ( )
public void getDeclaringClass ( )
public void getDeclaringFunction ( )
public void getDefaultValue ( )
public void getName ( )
public void getPosition ( )
public void isArray ( )
public void isDefaultValueAvailable ( )
public void isOptional ( )
public void isPassedByReference ( )
public void __clone ( )
public void __toString ( )

Methods

export

static mixed export( mixed $function , mixed $parameter , [boolean $return = false] )

Exports a reflection object.

Returns the output if TRUE is specified for $return, printing it otherwise. This is purely a wrapper method, which calls the corresponding method of the parent class.

Parameters:
Name Type Description
$function mixed Function or Method
$parameter mixed Parameter
$return boolean Whether to return (TRUE) or print (FALSE) the output
Redefinition of:
Method Description
ReflectionParameter::export ( $function, $parameter, [$return = ] )

__construct

ezcReflectionParameter __construct( string|array $functionOrMethod , $parameterPositionNameOrSource , [string $type = null] , integer|string|ReflectionParameter $parameter )

Constructor

If called with a ReflectionParameter instance as second argument the, first argument should be a string identifying the type of the parameter.

Parameters:
Name Type Description
$functionOrMethod string|array The function, method or type of the parameter given as function name, array($classname, $method), or array($object, $method)
$parameter integer|string|ReflectionParameter Position (starting at 0), name, or ReflectionParameter instance of the parameter to introspect.
$type string Type of the parameter given in form of the type name.
$parameterPositionNameOrSource
Exceptions:
Type Description
ReflectionException in case the given method or function does not exist.
Redefinition of:
Method Description
ReflectionParameter::constructor __construct ( $function, $parameter )

allowsNull

boolean allowsNull( )

Returns whether NULL is allowed as this parameters's value

Redefinition of:
Method Description
ReflectionParameter::allowsNull ( )

forwardCallToReflectionSource

mixed forwardCallToReflectionSource( string $method , [mixed[] $arguments = array()] )

Forwards a method invocation to either the reflection source passed to the constructor of this class when creating an instance or to the parent class.

This method is part of the dependency injection mechanism and serves as a helper for implementing wrapper methods without code duplication.

Parameters:
Name Type Description
$method string Name of the method to be invoked
$arguments mixed[] Arguments to be passed to the method

getClass

ezcReflectionClass|NULL getClass( )

Returns reflection object identified by type hinting or NULL if there is no hint

This method does not rely on type annotations. That gives users the freedom to decide on whether they want to trust the type annotations, i.e., by calling getType(), or only PHP's type hinting, which is the sole data source for this method.

Exceptions:
Type Description
ReflectionException if a parameter uses 'self' or 'parent' as type hint, but function is not a class member, if a parameter uses 'parent' as type hint, although class does not have a parent, or if the class does not exist
Redefinition of:
Method Description
ReflectionParameter::getClass ( )

getDeclaringClass

ezcReflectionClass getDeclaringClass( )

Returns in which class this parameter is defined (not the type hint of the parameter)

Redefinition of:
Method Description
ReflectionParameter::getDeclaringClass ( )

getDeclaringFunction

ezcReflectionFunction|ezcReflectionMethod getDeclaringFunction( )

Returns the function or method declaring this parameter

Redefinition of:
Method Description
ReflectionParameter::getDeclaringFunction ( )

getDefaultValue

mixed getDefaultValue( )

Returns the default value of this parameter or throws an exception

Redefinition of:
Method Description
ReflectionParameter::getDefaultValue ( )

getName

string getName( )

Returns this parameters's name

Redefinition of:
Method Description
ReflectionParameter::getName ( )

getPosition

integer getPosition( )

Returns whether this parameter is an optional parameter

Redefinition of:
Method Description
ReflectionParameter::getPosition ( )

getType

ezcReflectionType getType( )

Returns the type of this parameter in form of an ezcReflectionType

A valid type hint for the parameter will be preferred over a type annotation.

Exceptions:
Type Description
ReflectionException if a parameter uses 'self' or 'parent' as type hint, but function is not a class member, if a parameter uses 'parent' as type hint, although class does not have a parent, or if the class does not exist

isArray

boolean isArray( )

Returns whether parameter MUST be an array

Redefinition of:
Method Description
ReflectionParameter::isArray ( )

isDefaultValueAvailable

boolean isDefaultValueAvailable( )

Returns whether the default value of this parameter is available

Redefinition of:
Method Description
ReflectionParameter::isDefaultValueAvailable ( )

isOptional

boolean isOptional( )

Returns whether this parameter is an optional parameter

Redefinition of:
Method Description
ReflectionParameter::isOptional ( )

isPassedByReference

boolean isPassedByReference( )

Returns whether this parameters is passed to by reference

Redefinition of:
Method Description
ReflectionParameter::isPassedByReference ( )

__call

mixed __call( string $method , array $arguments )

Use overloading to call additional methods of the ReflectionParameter instance given to the constructor.

Parameters:
Name Type Description
$method string Method to be called
$arguments array Arguments that were passed

__toString

string __toString( )

Returns a string representation

Redefinition of:
Method Description
ReflectionParameter::__toString ( )
Documentation generated by phpDocumentor 1.4.3