codetodiagram.php
Go to the documentation of this file.00001 <?php
00017 error_reporting( E_ALL | E_NOTICE | E_PARSE );
00018 ini_set( 'display_errors', 'On' );
00019
00020 if( !isset( $strPublicPath ) )
00021 {
00022 #1. Define the public path
00023 $strPublicPath =str_replace( "\\" , "/" , str_replace( basename( __FILE__ ) , "" , __FILE__ ) );
00024
00025 #2. Load the components of the code to diagram
00026 require_once( $strPublicPath . "../components/library/_start.php" );
00027 require_once( $strPublicPath . "../components/loader/_start.php" );
00028 Loader::requireOnce( $strPublicPath . '../components/_start.php' );
00029
00030 #3. redefine the error handler function to the code to diagram
00031
00032 function error_handler($code, $message, $file, $line)
00033 {
00034 if (0 == error_reporting())
00035 {
00036 return;
00037 }
00038
00039 throw new CodeToDiagramException($message, 0, $code, $file, $line);
00040 }
00041
00042 #4. get the caller path
00043 $arrDebugBackTrace = debug_backtrace();
00044 $strFile = ( $arrDebugBackTrace[0][ 'file' ] );
00045 $strCallerPath = ( str_replace( basename( $strFile ) , "" , $strFile ) );
00046
00047 #5. get the relative path of the code to diagram bootstrap
00048 $strPathFile = CorujaFileManipulation::getRelativePath( $strCallerPath , $strPublicPath );
00049
00050 #6. add a instance of the code to diagram bootstrap into the load files array for the recursive call
00051 CodeToDiagram::getInstance()->addFile( $strPathFile . basename( __FILE__ ) , basename( __FILE__ ) );
00052
00053 #7. init the code to diagram
00054 CodeToDiagram::init( basename( $strFile ) );
00055 CodeToDiagram::getInstance()->setPublicPath( $strPublicPath );
00056 CodeToDiagram::getInstance()->setCallerPath( $strCallerPath );
00057 }
00058 ?>