ExtendedReflectionClass Class Reference

Inheritance diagram for ExtendedReflectionClass:

ReflectionClass CodeReflectionClass CodeInstrumentationClass

List of all members.

Public Member Functions

 getParentClass ()
 getInterfaces ()
 getProperties ($filter=-1)
 getProperty ($strName)
 getMethods ($filter=-1)
 getMethod ($strMethodName)

Protected Member Functions

 createExtendedReflectionClass (ReflectionClass $objOriginalReflectionClass)
 createExtendedReflectionProperty (ReflectionProperty $objOriginalReflectionProperty)
 createExtendedReflectionMethod (ReflectionMethod $objOriginalReflectionMethod)


Detailed Description

Class what make possible and easy extends reflection classes

Reflection classes can be a problem because the reflection methods what return objects will return the original reflection object and not the extended version of it. So it is necessary to create methods what convert the original methods to return the extended version of the objects.

Author:
Thiago Henrique Ramos da Mata <thiago.henrique.mata@gmail.com>

Definition at line 20 of file ExtendedReflectionClass.class.php.


Member Function Documentation

createExtendedReflectionClass ( ReflectionClass objOriginalReflectionClass  )  [protected]

Convert a reflection class into a extended reflection class

This is the method what should be replaced when this class be extended.

Parameters:
ReflectionClass $objOriginalReflectionClass
Returns:
ExtendedReflectionClass

Reimplemented in CodeInstrumentationClass, and CodeReflectionClass.

Definition at line 128 of file ExtendedReflectionClass.class.php.

Referenced by getInterfaces(), and getParentClass().

00129         {
00130                 return new ExtendedReflectionClass( $objOriginalReflectionClass->getName() );
00131         }

createExtendedReflectionMethod ( ReflectionMethod objOriginalReflectionMethod  )  [protected]

Convert a reflection method into a extended reflection method

This is the method what should be replaced when this class be extended.

Parameters:
ReflectionMethod $objOriginalReflectionMethod
Returns:
ExtendedReflectionMethod

Reimplemented in CodeInstrumentationClass, and CodeReflectionClass.

Definition at line 156 of file ExtendedReflectionClass.class.php.

Referenced by getMethod(), and getMethods().

00157         {
00158                 return new ExtendedReflectionMethod( $this->getName() , $objOriginalReflectionMethod->getName() );
00159         }

createExtendedReflectionProperty ( ReflectionProperty objOriginalReflectionProperty  )  [protected]

Convert a reflection property into a extended reflection property

This is the method what should be replaced when this class be extended.

Parameters:
ReflectionProperty $objOriginalReflectionProperty
Returns:
ExtendedReflectionProperty

Reimplemented in CodeInstrumentationClass, and CodeReflectionClass.

Definition at line 142 of file ExtendedReflectionClass.class.php.

Referenced by getProperties(), and getProperty().

00143         {
00144                 return new ExtendedReflectionProperty( $this->getName() , $objOriginalReflectionProperty->getName() );
00145         }

getInterfaces (  )  [final]

Get the collection of the reflection class of all the interfaces implemented by the reflected class

Returns:
ExtendedReflectionClass[]

Definition at line 47 of file ExtendedReflectionClass.class.php.

References createExtendedReflectionClass().

Referenced by CodeReflectionClass::createClassDefinitionCode().

00048         {
00049                 $arrOriginalInterfaces = parent::getInterfaces();
00050                 $arrExtendedInterfaces = array();
00051                 foreach( $arrOriginalInterfaces as $objInterface )
00052                 {
00053                         /*@var $objInterface ReflectionClass */
00054                         $arrExtendedInterfaces[] = $this->createExtendedReflectionClass( $objInterface );
00055                 }
00056                 return $arrExtendedInterfaces;
00057         }

getMethod ( strMethodName  )  [final]

Return the reflection of some method of the class

Parameters:
$strMethodName 
Returns:
ExtendedReflectionMethod

Definition at line 114 of file ExtendedReflectionClass.class.php.

References createExtendedReflectionMethod().

00115     {
00116         return $this->createExtendedReflectionMethod( parent::getMethod( $strMethodName ) );
00117     }

getMethods ( filter = -1  )  [final]

Get the collection of the reflected methods

Parameters:
$filter 
Returns:
ReflectionMethod[]

Definition at line 96 of file ExtendedReflectionClass.class.php.

References createExtendedReflectionMethod().

Referenced by CodeReflectionClass::createMethodsDefinitionCode(), and CodeInstrumentationClass::createMethodsDefinitionCode().

00097     {
00098         $arrReflectionMethods = parent::getMethods( $filter );
00099         $arrExtendedMethods = array();
00100         foreach( $arrReflectionMethods as $objReflectionMethod )
00101         {
00102                 /*@var $objReflectionMethod ReflectionMethod */
00103                 $arrExtendedMethods[] = $this->createExtendedReflectionMethod( $objReflectionMethod );
00104         }
00105         return $arrExtendedMethods;
00106     }

getParentClass (  )  [final]

Get the reflection of the parent class if extists and return null if not has a parent class

Returns:
ExtendedReflectionClass|null

Definition at line 28 of file ExtendedReflectionClass.class.php.

References createExtendedReflectionClass().

Referenced by CodeReflectionClass::createClassDefinitionCode().

00029         {
00030         $objParent = parent::getParentClass();
00031         if( $objParent != null )
00032         {
00033             return $this->createExtendedReflectionClass(  $objParent );
00034         }
00035         else
00036         {
00037             return null;
00038         }
00039         }

getProperties ( filter = -1  )  [final]

Get the collection of the reflection properties of the reflected class

Parameters:
integer $filter
Returns:
ReflectionProperty[]

Definition at line 66 of file ExtendedReflectionClass.class.php.

References createExtendedReflectionProperty().

Referenced by CodeReflectionClass::createAttributesDefinitionCode().

00067         {
00068                 $arrReflectionProperties = parent::getProperties( $filter );
00069                 $arrExtendedProperties = array();
00070                 foreach( $arrReflectionProperties as $objReflectionProperty )
00071                 {
00072                         /*@var $objReflectionProperty ReflectionProperty */
00073                         $arrExtendedProperties[] = $this->createExtendedReflectionProperty( $objReflectionProperty );
00074                 }
00075                 return $arrExtendedProperties;
00076         }

getProperty ( strName  )  [final]

Get the reflection property of some attribute of the class searched by the property name

Parameters:
string $strName
Returns:
ExtendedReflectionProperty

Definition at line 85 of file ExtendedReflectionClass.class.php.

References createExtendedReflectionProperty().

00086     {
00087         return $this->createExtendedReflectionProperty( parent::getProperty( $strName ) );
00088     }


The documentation for this class was generated from the following file:

Generated on Thu Feb 3 03:55:03 2011 for CodeToDiagram by  doxygen 1.5.9