コード例 #1
0
 /**
  * Run Doclet
  *
  */
 public function start($root)
 {
     // test hasNext()?
     while ($root->classes->hasNext()) {
         $ClassDoc = $root->classes->next();
         $classnames[] = $ClassDoc->qualifiedName();
     }
     // generate diagram via DiaMarshaller
     $Dia = DiaMarshaller::marshal($classnames, $root->option('recurse', 0), $root->option('depend', FALSE));
     // default destination is the current directory
     $filename = $root->option('directory', '.') . DIRECTORY_SEPARATOR;
     if ($root->option('diagram', FALSE)) {
         $filename .= $root->option('diagram');
     } else {
         $filename .= $ClassDoc->qualifiedName() . '.dia';
     }
     // save diagram to file
     $Dia->saveTo($filename, $root->option('gzipped', FALSE));
 }
コード例 #2
0
ファイル: update.php プロジェクト: Gamepay/xp-contrib
     $depend = $P->value('depend');
 }
 $classes = explode(',', $P->value('classes'));
 $file = $P->value('diagram');
 // if file does not exist: generate diagram
 if (!file_exists($file)) {
     Console::writeLine('File not found! Generating new diagram...');
     if (!isset($recurse)) {
         $recurse = 2;
         Console::writeLine('Using default "recurse=2"...');
     }
     if (!isset($depend)) {
         $depend = TRUE;
         Console::writeLine('Using default "depend=TRUE"...');
     }
     $Dia = DiaMarshaller::marshal($classes, $recurse, $depend);
     $Dia->saveTo($file, FALSE);
 } else {
     // else: update diagram
     Console::writeLine('Diagram file found: updating classes...');
     // initialize objects
     try {
         // Visitor checks if the given classes exist
         $Visitor = new UpdateVisitor($classes, TRUE, TRUE);
     } catch (Exception $e) {
         $e->printStackTrace();
         exit(-1);
     }
     Console::writeLine('Parsing XML diagram file...');
     try {
         $Dia = DiaUnmarshaller::unmarshal($file);