/**
  * Display final results
  *
  * Display final results, when data source parsing is over.
  *
  * @access public
  * @return void
  * @since  version 1.8.0b4 (2008-06-18)
  */
 function display()
 {
     $o = $this->args['output-level'];
     $info = $this->parseData;
     if ($info == false) {
         // protect against invalid data source
         print 'Invalid data source';
         return;
     }
     $src = $this->_parser->dataSource;
     if ($src['dataType'] == 'directory') {
         $dir = $src['dataSource'];
         $hdr_col1 = 'Directory';
     } elseif ($src['dataType'] == 'file') {
         $file = $src['dataSource'];
         $hdr_col1 = 'File';
     } else {
         $string = $src['dataSource'];
         $hdr_col1 = 'Source code';
     }
     $dataTable = new HTML_Table();
     $thead =& $dataTable->getHeader();
     $tbody =& $dataTable->getBody();
     $tfoot =& $dataTable->getFooter();
     $hdr = array($hdr_col1);
     $atr = array('scope="col"');
     if ($o & 16) {
         $hdr[] = 'Version';
         $atr[] = 'scope="col"';
     }
     if ($o & 1) {
         $hdr[] = 'C';
         $atr[] = 'scope="col"';
     }
     if ($o & 2) {
         $hdr[] = 'Extensions';
         $atr[] = 'scope="col"';
     }
     if ($o & 4) {
         if ($o & 8) {
             $hdr[] = 'Constants/Tokens';
             $atr[] = 'scope="col"';
         } else {
             $hdr[] = 'Constants';
             $atr[] = 'scope="col"';
         }
     } else {
         if ($o & 8) {
             $hdr[] = 'Tokens';
             $atr[] = 'scope="col"';
         }
     }
     $thead->addRow($hdr, $atr);
     $ext = implode("<br/>", $info['extensions']);
     $const = implode("<br/>", array_merge($info['constants'], $info['tokens']));
     if (isset($dir)) {
         $ds = DIRECTORY_SEPARATOR;
         $dir = str_replace(array('\\', '/'), $ds, $dir);
         $title = $src['dataCount'] . ' file';
         if ($src['dataCount'] > 1) {
             $title .= 's';
             // plural
         }
     } elseif (isset($file)) {
         $title = '1 file';
     } else {
         $title = '1 chunk of code';
     }
     $data = array('Summary: ' . $title . ' parsed');
     if ($o & 16) {
         if (empty($info['max_version'])) {
             $data[] = $info['version'];
         } else {
             $data[] = implode("<br/>", array($info['version'], $info['max_version']));
         }
     }
     if ($o & 1) {
         $data[] = $info['cond_code'][0];
     }
     if ($o & 2) {
         $data[] = $ext;
     }
     if ($o & 4) {
         if ($o & 8) {
             $data[] = $const;
         } else {
             $data[] = implode("<br/>", $info['constants']);
         }
     } else {
         if ($o & 8) {
             $data[] = implode("<br/>", $info['tokens']);
         }
     }
     // summary informations
     $tfoot->addRow($data);
     // summarize : print only summary for directory without files details
     if ($this->args['summarize'] === false && isset($dir)) {
         // display result of parsing multiple files
         unset($info['max_version']);
         unset($info['version']);
         unset($info['classes']);
         unset($info['functions']);
         unset($info['extensions']);
         unset($info['constants']);
         unset($info['tokens']);
         unset($info['cond_code']);
         $ignored = $info['ignored_files'];
         unset($info['ignored_files']);
         unset($info['ignored_functions']);
         unset($info['ignored_extensions']);
         unset($info['ignored_constants']);
         foreach ($info as $file => $info) {
             if ($info === false) {
                 continue;
                 // skip this (invalid) file
             }
             $ext = implode("<br/>", $info['extensions']);
             $const = implode("<br/>", array_merge($info['constants'], $info['tokens']));
             $file = str_replace(array('\\', '/'), $ds, $file);
             $path = dirname($file);
             $tbody->addRow(array($path), array('class' => 'dirname', 'colspan' => count($hdr)));
             $data = array(basename($file));
             if ($o & 16) {
                 if (empty($info['max_version'])) {
                     $data[] = $info['version'];
                 } else {
                     $data[] = implode("<br/>", array($info['version'], $info['max_version']));
                 }
             }
             if ($o & 1) {
                 $data[] = $info['cond_code'][0];
             }
             if ($o & 2) {
                 $data[] = $ext;
             }
             if ($o & 4) {
                 if ($o & 8) {
                     $data[] = $const;
                 } else {
                     $data[] = implode("<br/>", $info['constants']);
                 }
             } else {
                 if ($o & 8) {
                     $data[] = implode("<br/>", $info['tokens']);
                 }
             }
             $tbody->addRow($data);
         }
     } elseif ($this->args['summarize'] === false && !isset($dir)) {
         // display result of parsing a single file, or a chunk of code
         if (isset($file)) {
             $path = dirname($file);
         } else {
             $path = '.';
         }
         $tbody->addRow(array($path), array('class' => 'dirname', 'colspan' => count($hdr)));
         if (isset($file)) {
             $data[0] = basename($file);
         } else {
             $data[0] = htmlspecialchars('<?php ... ?>');
         }
         $tbody->addRow($data);
     } else {
         // display only result summary of parsing a data source
         if (isset($dir)) {
             $path = dirname($dir[0]);
         } elseif (isset($file)) {
             $path = dirname($file);
         } else {
             $path = '.';
         }
         $tbody->addRow(array($path), array('class' => 'dirname', 'colspan' => count($hdr)));
     }
     $evenRow = array('class' => 'even');
     $oddRow = null;
     $tbody->altRowAttributes(1, $evenRow, $oddRow, true);
     echo $this->toHtml($dataTable);
 }