test1.php

Go to the documentation of this file.
00001 <?php
00002 require_once( "_start.php" );
00003 
00004 
00005 $strBigFile = '
00006 class fatorial
00007 {
00008     protected $n;
00009 
00010     public function __construct( $n )
00011     {
00012         $this->n = $n;
00013     }
00014 
00015     public function calc()
00016     {
00017         if ($this->n < 2)
00018         {
00019             return 1;
00020         }
00021         else
00022         {
00023             $objFat = new Fatorial( $this->n - 1 );
00024             return $this->n * $objFat->calc();
00025         }
00026     }
00027 };
00028 ';
00029 
00030 $strBigFile = str_replace( "class fatorial", "class temp_fatorial", $strBigFile );
00031 eval( $strBigFile );
00032 // call the debug reflection send into the second parameter the eval content //
00033 $oReflectionCode = new CodeInstrumentationClass( "temp_fatorial" , $strBigFile );
00034 $oReflectionCode->setClassName( "fatorial" );
00035 $strNewCode = $oReflectionCode->getCode();
00036 eval( $strNewCode );
00037 define( "PUBLIC_PATH" , str_replace( "\\" , "/" , str_replace( basename( __FILE__ ) , "" , __FILE__ ) ) );
00038 define( "CALLER_PATH" , str_replace( "\\" , "/" , str_replace( basename( __FILE__ ) , "" , __FILE__ ) ) );
00039 CodeInstrumentationReceiver::getInstance()->restart();
00040 $objTest = new fatorial( 2 );
00041 $objTest->calc();
00042 $objSimpleXml = simplexml_load_string( CodeInstrumentationReceiver::getInstance()->getXmlSequence()->createXml() );
00043 print $objSimpleXml->asXml();
00044 ?>

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