CodeReflectionFunction Class Reference

Inheritance diagram for CodeReflectionFunction:

ExtendedReflectionFunction ReflectionFunction CodeInstrumentationFunction

List of all members.

Public Member Functions

 getCode ()
 getCodeContent ()
 createFunctionHeaderCode ()

Protected Member Functions

 createExtendedReflectionParameter (ReflectionParameter $objReflectionParameter)
 createParametersCode ()
 createFunctionContentCode ()


Detailed Description

Generate the code definition of some function based into its reflection information

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

Definition at line 14 of file CodeReflectionFunction.class.php.


Member Function Documentation

createExtendedReflectionParameter ( ReflectionParameter objReflectionParameter  )  [protected]

Make the reflection parameter link return a code reflection parameter

See also:
ExtendedReflectionFunction::createExtendedReflectionParameter()
Parameters:
ReflectionParameter $objReflectionParameter
Returns:
CodeReflectionParameter

Reimplemented from ExtendedReflectionFunction.

Reimplemented in CodeInstrumentationFunction.

Definition at line 49 of file CodeReflectionFunction.class.php.

00050         {
00051                 return new CodeReflectionParameter( null , $this->getName() , $objReflectionParameter->getName() );
00052         }

createFunctionContentCode (  )  [protected]

Creater the function content

Returns:
string

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

References $strFileName, and CodeReflectionFile::getCodeInstrFileName().

Referenced by getCode().

00097         {
00098                 $strCode = "";
00099 
00100                 $strFileName = $this->getFileName();
00101 
00102         $objFile = CodeReflectionFile::getCodeInstrFileName( $strFileName );
00103 
00104         $strCode = $objFile->getFileBit( $this->getStartLine() ,  $this->getEndLine() );
00105 
00106                 $strCode = trim( $strCode );
00107 
00108                 // remove the { }
00109                 if( $strCode[0] == "{" )
00110                 {
00111                         $strCode = substr( $strCode , 1 , -1);
00112                 }
00113                 return $strCode;
00114         }

createFunctionHeaderCode (  ) 

Create the function header code

Definition at line 81 of file CodeReflectionFunction.class.php.

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

Referenced by getCode().

00082         {
00083                 $strCode = $this->getDocComment();
00084                 $strCode .= " function ";
00085                 $strCode .= $this->getName();
00086                 $strCode .= $this->createParametersCode();
00087 
00088                 return CorujaStringManipulation::retab( $strCode , 1 );
00089         }

createParametersCode (  )  [protected]

Get the code of the parameters definition

Returns:
string

Definition at line 59 of file CodeReflectionFunction.class.php.

References ExtendedReflectionFunction::getParameters().

Referenced by createFunctionHeaderCode().

00060         {
00061                 $strCode = "";
00062                 $arrParameters = $this->getParameters();
00063                 $arrParametersName = array();
00064 
00065                 foreach(  $arrParameters as $objParameter )
00066                 {
00067                         /*@var $objParameter CodeReflectionParameter */
00068                         $arrParametersName[] = $objParameter->getCode();
00069                 }
00070 
00071                 $strCode .= "(";
00072                 $strCode .= implode( ", " , $arrParametersName);
00073                 $strCode .= ")";
00074                 return $strCode;
00075         }

getCode (  ) 

Create the code of the function based into reflection's information

Returns:
string

Definition at line 21 of file CodeReflectionFunction.class.php.

References createFunctionContentCode(), and createFunctionHeaderCode().

00022         {
00023                 $strCode = "";
00024                 $strCode .= $this->createFunctionHeaderCode();
00025                 $strCode .= "{";
00026                 $strCode .= $this->createFunctionContentCode();
00027                 $strCode .= "}\n";
00028 
00029                 return $strCode;
00030         }

getCodeContent (  ) 

Get the code content

Returns:
string

Definition at line 37 of file CodeReflectionFunction.class.php.

00038     {
00039         return $this->createMethodContentCode();
00040     }


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