Extends the ReflectionMethod class to provide type information using PHPDoc annotations.
Source for this file: /Reflection/src/method.php
ReflectionMethod | --ezcReflectionMethod
Version: | //autogen// |
From ReflectionMethod (Internal Class): | |
---|---|
IS_ABSTRACT = 2
|
|
IS_FINAL = 4
|
|
IS_PRIVATE = 1024
|
|
IS_PROTECTED = 512
|
|
IS_PUBLIC = 256
|
|
IS_STATIC = 1
|
protected ReflectionClass |
$currentClass
|
protected ezcReflectionDocCommentParser |
$docParser
|
protected ReflectionMethod |
$reflectionSource
= null
|
From ReflectionMethod (Internal Class) | |
---|---|
public |
$class
|
public |
$name
|
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 |
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 ( )
|
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()).
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 |
Method | Description |
---|---|
ReflectionMethod::export ( $class, $name, [$return = ] ) |
Constructs an new ezcReflectionMethod
Usage Examples:
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:
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 |
Method | Description |
---|---|
ReflectionMethod::constructor __construct ( $class_or_method, [$name = ] ) |
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.
Name | Type | Description |
---|---|---|
$method |
string | Name of the method to be invoked |
$arguments |
mixed[] | Arguments to be passed to the method |
Returns an array of annotations (optinally only annotations of a given name)
Name | Type | Description |
---|---|---|
$name |
string | Name of the annotations |
Returns the source code of the method
Returns the class of the reflected method, which is not necesarily the declaring class.
Returns the class the method was declared in
Method | Description |
---|---|
ReflectionMethod::getDeclaringClass ( ) |
Returns the doc comment for the method.
Method | Description |
---|---|
ReflectionMethod::getDocComment ( ) |
Returns the line this method's declaration ends at
Method | Description |
---|---|
ReflectionMethod::getEndLine ( ) |
Returns NULL or the extension the method belongs to
Method | Description |
---|---|
ReflectionMethod::getExtension ( ) |
Returns false or the name of the extension the method belongs to
Method | Description |
---|---|
ReflectionMethod::getExtensionName ( ) |
Returns the filename of the file this function was declared in
Method | Description |
---|---|
ReflectionMethod::getFileName ( ) |
Returns the long description from the method's documentation
Returns a bitfield of the access modifiers for this method
Method | Description |
---|---|
ReflectionMethod::getModifiers ( ) |
Name of the method
Method | Description |
---|---|
ReflectionMethod::getName ( ) |
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.
Method | Description |
---|---|
ReflectionMethod::getNamespaceName ( ) |
Returns the number of parameters
Method | Description |
---|---|
ReflectionMethod::getNumberOfParameters ( ) |
Returns the number of required parameters
Method | Description |
---|---|
ReflectionMethod::getNumberOfRequiredParameters ( ) |
Returns the parameters of the method as ezcReflectionParameter objects
Method | Description |
---|---|
ReflectionMethod::getParameters ( ) |
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
Type | Description |
---|---|
ReflectionException |
if the method has no prototype |
Method | Description |
---|---|
ReflectionMethod::getPrototype ( ) |
Returns the description after a PHPDoc annotation
Returns the type defined in PHPDoc annotations
Returns the short description from the method's documentation
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.
Method | Description |
---|---|
ReflectionMethod::getShortName ( ) |
Returns the line this method's declaration starts at
Method | Description |
---|---|
ReflectionMethod::getStartLine ( ) |
Returns an associative array containing this method's static variables and their values
Method | Description |
---|---|
ReflectionMethod::getStaticVariables ( ) |
Checks whether the method is annotated with the annotation $annotation
Name | Type | Description |
---|---|---|
$annotation |
string | Name of the annotation |
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.
Method | Description |
---|---|
ReflectionMethod::inNamespace ( ) |
Invokes the method on a given object
Name | Type | Description |
---|---|---|
$object |
object | Instance of the class defining this method |
$argument,... |
mixed | Arguments for the method |
$arguments |
Method | Description |
---|---|
ReflectionMethod::invoke ( $object, $args ) |
Invokes the Method and allows to pass its arguments as an array
Name | Type | Description |
---|---|---|
$object |
object | Instance of the class defining this method |
$arguments |
array |
Arguments |
Method | Description |
---|---|
ReflectionMethod::invokeArgs ( $object, $args ) |
Returns whether this method is abstract
Method | Description |
---|---|
ReflectionMethod::isAbstract ( ) |
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.
Method | Description |
---|---|
ReflectionMethod::isClosure ( ) |
Returns whether this method is a constructor
Method | Description |
---|---|
ReflectionMethod::isConstructor ( ) |
Returns whether this method is deprecated.
This is purely a wrapper method, which calls the corresponding method of the parent class.
Method | Description |
---|---|
ReflectionMethod::isDeprecated ( ) |
Returns whether this method is a destructor
Method | Description |
---|---|
ReflectionMethod::isDestructor ( ) |
Returns whether this method is final
Method | Description |
---|---|
ReflectionMethod::isFinal ( ) |
Checks if this is already available in the parent class
Returns whether this is an internal method
Method | Description |
---|---|
ReflectionMethod::isInternal ( ) |
Checks if this method is appeared first in the current class
Checks if this method is a 'Magic Method' or not
Checks if this method is redefined in this class
Returns whether this method is private
Method | Description |
---|---|
ReflectionMethod::isPrivate ( ) |
Returns whether this method is protected
Method | Description |
---|---|
ReflectionMethod::isProtected ( ) |
Returns whether this method is public
Method | Description |
---|---|
ReflectionMethod::isPublic ( ) |
Returns whether this method is static
Method | Description |
---|---|
ReflectionMethod::isStatic ( ) |
Returns whether this is a user-defined method
Method | Description |
---|---|
ReflectionMethod::isUserDefined ( ) |
Returns whether this method returns a reference
Method | Description |
---|---|
ReflectionMethod::returnsReference ( ) |
Use overloading to call additional methods of the ReflectionMethod instance given to the constructor.
Name | Type | Description |
---|---|---|
$method |
string | Method to be called |
$arguments |
array | Arguments that were passed |
Returns a string representation
Method | Description |
---|---|
ReflectionMethod::__toString ( ) |