Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcReflectionMethod

Reflection::ezcReflectionMethod

Class ezcReflectionMethod

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

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

ReflectionMethod
   |
   --ezcReflectionMethod
Version:   //autogen//

Inherited Constants

From ReflectionMethod (Internal Class):
IS_ABSTRACT = 2
IS_FINAL = 4
IS_PRIVATE = 1024
IS_PROTECTED = 512
IS_PUBLIC = 256
IS_STATIC = 1

Member Variables

protected ReflectionClass $currentClass
protected ezcReflectionDocCommentParser $docParser
protected ReflectionMethod $reflectionSource = null

Inherited Member Variables

From ReflectionMethod (Internal Class)
public $class
public $name

Method Summary

public static mixed export( $class , $name , [ $return = false] )
Exports a reflection method object.
public ezcReflectionMethod __construct( $classOrSource , [ $nameOrSource = null] )
Constructs an new ezcReflectionMethod
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 ezcReflectionAnnotation[] getAnnotations( [ $name = ''] )
Returns an array of annotations (optinally only annotations of a given name)
public string getCode( )
Returns the source code of the method
public ezcReflectionClass getCurrentClass( )
Returns the class of the reflected method, which is not necesarily the declaring class.
public ezcReflectionClass getDeclaringClass( )
Returns the class the method was declared in
public string getDocComment( )
Returns the doc comment for the method.
public integer getEndLine( )
Returns the line this method's declaration ends at
public ezcReflectionExtension getExtension( )
Returns NULL or the extension the method belongs to
public string|boolean getExtensionName( )
Returns false or the name of the extension the method belongs to
public string getFileName( )
Returns the filename of the file this function was declared in
public string getLongDescription( )
Returns the long description from the method's documentation
public integer getModifiers( )
Returns a bitfield of the access modifiers for this method
public string getName( )
Name of the method
public string getNamespaceName( )
Returns the name of namespace where this method is defined
public integer getNumberOfParameters( )
Returns the number of parameters
public integer getNumberOfRequiredParameters( )
Returns the number of required parameters
public ezcReflectionParameter[] getParameters( )
Returns the parameters of the method as ezcReflectionParameter objects
public ezcReflectionClass getPrototype( )
Returns the prototype.
public string getReturnDescription( )
Returns the description after a PHPDoc annotation
public ezcReflectionType getReturnType( )
Returns the type defined in PHPDoc annotations
public string getShortDescription( )
Returns the short description from the method's documentation
public string getShortName( )
Returns the short name of the method (without namespace part)
public integer getStartLine( )
Returns the line this method's declaration starts at
public array getStaticVariables( )
Returns an associative array containing this method's static variables and their values
public boolean hasAnnotation( $annotation )
Checks whether the method is annotated with the annotation $annotation
public boolean inNamespace( )
Returns whether this method is defined in a namespace
public mixed invoke( $object , $arguments , $argument,... )
Invokes the method on a given object
public mixed invokeArgs( $object , $arguments )
Invokes the Method and allows to pass its arguments as an array
public boolean isAbstract( )
Returns whether this method is abstract
public boolean isClosure( )
Returns whether this is a closure
public boolean isConstructor( )
Returns whether this method is a constructor
public boolean isDeprecated( )
Returns whether this method is deprecated.
public boolean isDestructor( )
Returns whether this method is a destructor
public boolean isFinal( )
Returns whether this method is final
public boolean isInherited( )
Checks if this is already available in the parent class
public boolean isInternal( )
Returns whether this is an internal method
public boolean isIntroduced( )
Checks if this method is appeared first in the current class
public boolean isMagic( )
Checks if this method is a 'Magic Method' or not
public boolean isOverridden( )
Checks if this method is redefined in this class
public boolean isPrivate( )
Returns whether this method is private
public boolean isProtected( )
Returns whether this method is protected
public boolean isPublic( )
Returns whether this method is public
public boolean isStatic( )
Returns whether this method is static
public boolean isUserDefined( )
Returns whether this is a user-defined method
public boolean returnsReference( )
Returns whether this method returns a reference
public mixed __call( $method , $arguments )
Use overloading to call additional methods of the ReflectionMethod instance given to the constructor.
public string __toString( )
Returns a string representation

Inherited Methods

From ReflectionMethod (Internal Class)
public ReflectionMethod constructor __construct ( $class_or_method, [$name = ] )
public void export ( $class, $name, [$return = ] )
public void getDeclaringClass ( )
public void getDocComment ( )
public void getEndLine ( )
public void getExtension ( )
public void getExtensionName ( )
public void getFileName ( )
public void getModifiers ( )
public void getName ( )
public void getNamespaceName ( )
public void getNumberOfParameters ( )
public void getNumberOfRequiredParameters ( )
public void getParameters ( )
public void getPrototype ( )
public void getShortName ( )
public void getStartLine ( )
public void getStaticVariables ( )
public void inNamespace ( )
public void invoke ( $object, $args )
public void invokeArgs ( $object, $args )
public void isAbstract ( )
public void isClosure ( )
public void isConstructor ( )
public void isDeprecated ( )
public void isDestructor ( )
public void isFinal ( )
public void isInternal ( )
public void isPrivate ( )
public void isProtected ( )
public void isPublic ( )
public void isStatic ( )
public void isUserDefined ( )
public void returnsReference ( )
public void setAccessible ( $value )
public void __clone ( )
public void __toString ( )

Methods

export

static mixed export( string|object $class , string $name , [boolean $return = false] )

Exports a reflection method 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 (ReflectionMethod::export()).

Parameters:
Name Type Description
$class string|object Name or instance of the class declaring the method
$name string Name of the method
$return boolean Whether to return (TRUE) or print (FALSE) the output
Redefinition of:
Method Description
ReflectionMethod::export ( $class, $name, [$return = ] )

__construct

ezcReflectionMethod __construct( string|ReflectionClass|ReflectionMethod $classOrSource , [string|ReflectionMethod $nameOrSource = null] )

Constructs an new ezcReflectionMethod

Usage Examples:

  1.  new ezcReflectionMethod( 'SomeClass',                        'someMethod' );
  2.  new ezcReflectionMethod( new ReflectionClass( 'SomeClass' ), 'someMethod' );
  3.  new ezcReflectionMethod( 'SomeClass',                        new ReflectionMethod( 'SomeClass', 'someMethod' ) );
  4.  new ezcReflectionMethod( new ReflectionClass( 'SomeClass' ), new ReflectionMethod( 'SomeClass', 'someMethod' ) );

The following way of creating an ezcReflectionMethod results in the current class being the declaring class, i.e., isInherited() and isIntroduced() may not return the expected results:

  1.  new ezcReflectionMethod( new ReflectionMethod( 'SomeClass', 'someMethod' ) );
Parameters:
Name Type Description
$classOrSource string|ReflectionClass|ReflectionMethod Name of class, ReflectionClass, or ReflectionMethod of the method to be reflected
$nameOrSource string|ReflectionMethod Name or ReflectionMethod instance of the method to be reflected Optional if $classOrSource is an instance of ReflectionMethod
Redefinition of:
Method Description
ReflectionMethod::constructor __construct ( $class_or_method, [$name = ] )

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

getAnnotations

ezcReflectionAnnotation[] getAnnotations( [string $name = ''] )

Returns an array of annotations (optinally only annotations of a given name)

Parameters:
Name Type Description
$name string Name of the annotations

getCode

string getCode( )

Returns the source code of the method

getCurrentClass

ezcReflectionClass getCurrentClass( )

Returns the class of the reflected method, which is not necesarily the declaring class.

getDeclaringClass

ezcReflectionClass getDeclaringClass( )

Returns the class the method was declared in

Redefinition of:
Method Description
ReflectionMethod::getDeclaringClass ( )

getDocComment

string getDocComment( )

Returns the doc comment for the method.

Redefinition of:
Method Description
ReflectionMethod::getDocComment ( )

getEndLine

integer getEndLine( )

Returns the line this method's declaration ends at

Redefinition of:
Method Description
ReflectionMethod::getEndLine ( )

getExtension

ezcReflectionExtension getExtension( )

Returns NULL or the extension the method belongs to

Redefinition of:
Method Description
ReflectionMethod::getExtension ( )

getExtensionName

string|boolean getExtensionName( )

Returns false or the name of the extension the method belongs to

Redefinition of:
Method Description
ReflectionMethod::getExtensionName ( )

getFileName

string getFileName( )

Returns the filename of the file this function was declared in

Redefinition of:
Method Description
ReflectionMethod::getFileName ( )

getLongDescription

string getLongDescription( )

Returns the long description from the method's documentation

getModifiers

integer getModifiers( )

Returns a bitfield of the access modifiers for this method

Redefinition of:
Method Description
ReflectionMethod::getModifiers ( )

getName

string getName( )

Name of the method

Redefinition of:
Method Description
ReflectionMethod::getName ( )

getNamespaceName

string getNamespaceName( )

Returns the name of namespace where this method is defined

This is purely a wrapper method, which either calls the corresponding method of the parent class or forwards the call to the ReflectionClass instance passed to the constructor.

Redefinition of:
Method Description
ReflectionMethod::getNamespaceName ( )

getNumberOfParameters

integer getNumberOfParameters( )

Returns the number of parameters

Redefinition of:
Method Description
ReflectionMethod::getNumberOfParameters ( )

getNumberOfRequiredParameters

integer getNumberOfRequiredParameters( )

Returns the number of required parameters

Redefinition of:
Method Description
ReflectionMethod::getNumberOfRequiredParameters ( )

getParameters

ezcReflectionParameter[] getParameters( )

Returns the parameters of the method as ezcReflectionParameter objects

Redefinition of:
Method Description
ReflectionMethod::getParameters ( )

getPrototype

ezcReflectionClass getPrototype( )

Returns the prototype.

This is mostly a wrapper method, which calls the corresponding method of the parent class. The only difference is that it returns an instance ezcReflectionClass instead of a ReflectionClass instance

Exceptions:
Type Description
ReflectionException if the method has no prototype
Redefinition of:
Method Description
ReflectionMethod::getPrototype ( )

getReturnDescription

string getReturnDescription( )

Returns the description after a PHPDoc annotation

getReturnType

ezcReflectionType getReturnType( )

Returns the type defined in PHPDoc annotations

getShortDescription

string getShortDescription( )

Returns the short description from the method's documentation

getShortName

string getShortName( )

Returns the short name of the method (without namespace part)

This is purely a wrapper method, which either calls the corresponding method of the parent class or forwards the call to the ReflectionClass instance passed to the constructor.

Redefinition of:
Method Description
ReflectionMethod::getShortName ( )

getStartLine

integer getStartLine( )

Returns the line this method's declaration starts at

Redefinition of:
Method Description
ReflectionMethod::getStartLine ( )

getStaticVariables

array getStaticVariables( )

Returns an associative array containing this method's static variables and their values

Redefinition of:
Method Description
ReflectionMethod::getStaticVariables ( )

hasAnnotation

boolean hasAnnotation( string $annotation )

Checks whether the method is annotated with the annotation $annotation

Parameters:
Name Type Description
$annotation string Name of the annotation

inNamespace

boolean inNamespace( )

Returns whether this method is defined in a namespace

This is purely a wrapper method, which either calls the corresponding method of the parent class or forwards the call to the ReflectionClass instance passed to the constructor.

Redefinition of:
Method Description
ReflectionMethod::inNamespace ( )

invoke

mixed invoke( object $object , $arguments , mixed $argument,... )

Invokes the method on a given object

Parameters:
Name Type Description
$object object Instance of the class defining this method
$argument,... mixed Arguments for the method
$arguments
Redefinition of:
Method Description
ReflectionMethod::invoke ( $object, $args )

invokeArgs

mixed invokeArgs( object $object , $arguments )

Invokes the Method and allows to pass its arguments as an array

Parameters:
Name Type Description
$object object Instance of the class defining this method
$arguments array Arguments
Redefinition of:
Method Description
ReflectionMethod::invokeArgs ( $object, $args )

isAbstract

boolean isAbstract( )

Returns whether this method is abstract

Redefinition of:
Method Description
ReflectionMethod::isAbstract ( )

isClosure

boolean isClosure( )

Returns whether this is a closure

This is purely a wrapper method, which either calls the corresponding method of the parent class or forwards the call to the ReflectionClass instance passed to the constructor.

Redefinition of:
Method Description
ReflectionMethod::isClosure ( )

isConstructor

boolean isConstructor( )

Returns whether this method is a constructor

Redefinition of:
Method Description
ReflectionMethod::isConstructor ( )

isDeprecated

boolean isDeprecated( )

Returns whether this method is deprecated.

This is purely a wrapper method, which calls the corresponding method of the parent class.

Redefinition of:
Method Description
ReflectionMethod::isDeprecated ( )

isDestructor

boolean isDestructor( )

Returns whether this method is a destructor

Redefinition of:
Method Description
ReflectionMethod::isDestructor ( )

isFinal

boolean isFinal( )

Returns whether this method is final

Redefinition of:
Method Description
ReflectionMethod::isFinal ( )

isInherited

boolean isInherited( )

Checks if this is already available in the parent class

isInternal

boolean isInternal( )

Returns whether this is an internal method

Redefinition of:
Method Description
ReflectionMethod::isInternal ( )

isIntroduced

boolean isIntroduced( )

Checks if this method is appeared first in the current class

isMagic

boolean isMagic( )

Checks if this method is a 'Magic Method' or not

isOverridden

boolean isOverridden( )

Checks if this method is redefined in this class

isPrivate

boolean isPrivate( )

Returns whether this method is private

Redefinition of:
Method Description
ReflectionMethod::isPrivate ( )

isProtected

boolean isProtected( )

Returns whether this method is protected

Redefinition of:
Method Description
ReflectionMethod::isProtected ( )

isPublic

boolean isPublic( )

Returns whether this method is public

Redefinition of:
Method Description
ReflectionMethod::isPublic ( )

isStatic

boolean isStatic( )

Returns whether this method is static

Redefinition of:
Method Description
ReflectionMethod::isStatic ( )

isUserDefined

boolean isUserDefined( )

Returns whether this is a user-defined method

Redefinition of:
Method Description
ReflectionMethod::isUserDefined ( )

returnsReference

boolean returnsReference( )

Returns whether this method returns a reference

Redefinition of:
Method Description
ReflectionMethod::returnsReference ( )

__call

mixed __call( string $method , array $arguments )

Use overloading to call additional methods of the ReflectionMethod 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
ReflectionMethod::__toString ( )
Documentation generated by phpDocumentor 1.4.3