CodeReflectionProperty Class Reference

Inheritance diagram for CodeReflectionProperty:

ExtendedReflectionProperty ReflectionProperty CodeInstrumentationProperty

List of all members.

Public Member Functions

 getDefaultValue ()
 getCode ()

Protected Member Functions

 createExtendedReflectionClass (ReflectionClass $objOriginalReflectionClass)


Detailed Description

Code Reflection Property it is a code reflection version of the reflection property

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

Definition at line 13 of file CodeReflectionProperty.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 from ExtendedReflectionProperty.

Reimplemented in CodeInstrumentationProperty.

Definition at line 83 of file CodeReflectionProperty.class.php.

00084         {
00085                 return new CodeReflectionClass( $objOriginalReflectionClass->getName() );
00086         }

getCode (  ) 

Definition at line 54 of file CodeReflectionProperty.class.php.

References getDefaultValue(), and CorujaStringManipulation::retab().

00055         {
00056 
00057         $strCode = "";
00058                 $strCode .= CorujaStringManipulation::retab( $this->getDocComment() , 1 );
00059                 if( $this->isPrivate() )
00060                 {
00061                         $strCode .= " private ";
00062                 }
00063                 if( $this->isProtected())
00064                 {
00065                         $strCode .= " protected ";
00066                 }
00067                 if( $this->isPublic())
00068                 {
00069                         $strCode .= " public ";
00070                 }
00071                 if( $this->isStatic() )
00072                 {
00073                         $strCode .= " static ";
00074                 }
00075                 $strCode .= '$'. $this->getName();
00076 
00077         $strCode .= ' = ' . var_export( $this->getDefaultValue() , true );
00078                 $strCode .= ";" . "\n";
00079 
00080                 return $strCode;
00081         }

getDefaultValue (  ) 

Get the default value of the property.

While the PHP Reflection don't make this method native. We have to create this workaround to get the default value of the attribute. This brings a problem of classes what need of paramenters into it's constructors. In this cases, the default value will be ignored.

getDafaultValue don't exist into reflection

Fixme:
unable to get default value on constructors with parameters
Todo:
get the default value of the attribute reading direct from the file
Returns:
mix

Definition at line 29 of file CodeReflectionProperty.class.php.

Referenced by getCode().

00030     {
00031         /*
00032         try
00033         {
00034             $objParent = $this->getDeclaringClass();
00035             $strClassName = $objParent->getClassName();
00036             $objTemp = new $strClassName();
00037             $arrTemp = (array)$objTemp;
00038             $arrNew = array();
00039             foreach( $arrTemp as $strKeyTemp => $mixValue )
00040             {
00041                 $strNewKey = substr( $strKeyTemp , 3 );
00042                 $arrNew[ $strNewKey ] = $mixValue;
00043             }
00044             return $arrNew[ $this->getName() ];
00045         }catch( Exception $objException )
00046         {
00047             // error on init object //
00048             return null;
00049         }
00050          * *
00051          */
00052         return null;
00053     }


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