Exemple #1
0
$files = $xref->filterFiles($file_provider->getFiles());
foreach ($files as $filename) {
    try {
        $file_content = $file_provider->getFileContent($filename);
        $pf = $xref->getParsedFile($filename, $file_content);
        foreach ($plugins as $pluginId => $plugin) {
            $plugin->generateFileReport($pf);
        }
        $numberOfFiles++;
        $numberOfCodeLines += $pf->getNumberOfLines();
        $pf->release();
        // help PHP garbage collector to free memory
    } catch (Exception $e) {
        error_log("Can't process file '{$filename}': " . $e->getMessage() . "\n");
    }
}
// 2. Notify each plugin that all files are done
foreach ($plugins as $pluginId => $plugin) {
    $plugin->generateTotalReport();
}
// 3. Create index page
$reports = array();
// report name --> report url
foreach ($plugins as $pluginId => $plugin) {
    $reports = array_merge($reports, $plugin->getReportLink());
}
ksort($reports);
list($fh) = $xref->getOutputFileHandle("index", null);
fwrite($fh, $xref->fillTemplate("doc-index.tmpl", array('reports' => $reports, 'date' => date(DATE_RFC850), 'numberOfFiles' => $numberOfFiles, 'numberOfCodeLines' => $numberOfCodeLines)));
fclose($fh);
// vim: tabstop=4 expandtab