00001 <?php 00022 // load the start of the code to diagram // 00023 require_once( '../../public/codetodiagram.php' ); 00024 00025 CodeToDiagram::getInstance()->getConfiguration()->getMatchGroupStereotypes() 00026 ->addItemName( "History" , UmlSequenceDiagramStereotype::getStereotypeByName( "boundary" ) ) 00027 ->addItemName( "Wolf" , UmlSequenceDiagramStereotype::getStereotypeByName( "user" ) ) 00028 ->addItemName( "LittlePig" , UmlSequenceDiagramStereotype::getStereotypeByName( "controller" ) ) 00029 ->addItemName( "House" , UmlSequenceDiagramStereotype::getStereotypeByName( "entity" ) ) 00030 ; 00031 # create the diagram of the history and save it into some file { 00032 00033 // change the output type from screen to file // 00034 CodeToDiagram::getInstance()->setOutputType( CodeToDiagram::OUTPUT_TYPE_FILE ); 00035 00036 00037 CodeToDiagram::getInstance()->getPrinterConfiguration()->setWidth( 2000 ); 00038 00039 // set the file name // 00040 CodeToDiagram::getInstance()->setFileName( 'threeLitlePigs.html' ); 00041 00042 // start the code recording // 00043 CodeToDiagram::getInstance()->start(); 00044 00045 # this code will be saved { 00046 require_once( 'Wolf.class.php' ); 00047 require_once( 'Pig.class.php' ); 00048 require_once( 'House.class.php' ); 00049 require_once( 'History.class.php' ); 00050 new History(); 00051 # } using the file with the specified name 00052 00053 // save it into the file // 00054 CodeToDiagram::getInstance()->save(); 00055 # } the file is saved // 00056 00057 /* 00058 # this code will not be into any diagram { 00059 $objPig = new LittlePig(); 00060 $objPig->setName( "GreenPig" ); 00061 $objPig->say( "this will to no diagram " ); 00062 # } because the restart command 00063 00064 // this restart clean at all // 00065 CodeToDiagram::getInstance()->restart(); 00066 00067 # now reconfig to save the rest of execution into a new file {` 00068 00069 // output will be a file // 00070 CodeToDiagram::getInstance()->setOutputType( CodeToDiagram::OUTPUT_TYPE_FILE ); 00071 00072 // name of the new file // 00073 CodeToDiagram::getInstance()->setFileName( 'threeLitlePigs2.html' ); 00074 00075 # this code will be saved { 00076 $objWolf = new Wolf(); 00077 $objWolf->say( "i will be back " . date( "h:i:s") ); 00078 unset( $objWolf ); 00079 CodeToDiagram::getInstance()->save(); 00080 # } into the new file 00081 00082 # } the file is saved 00083 * 00084 */ 00085 ?>
1.5.9