
Public Member Functions | |
| getDefaultValue () | |
| getCode () | |
Protected Member Functions | |
| createExtendedReflectionClass (ReflectionClass $objOriginalReflectionClass) | |
Definition at line 13 of file CodeReflectionProperty.class.php.
| 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.
| ReflectionClass | $objOriginalReflectionClass |
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
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 }
1.5.9