public function generate(AnalyzerResult $result) { $numUndead = $result->getUndeadCount(); $numDead = $result->getDeadCount(); $numDeleted = $result->getDeletedCount(); $this->output->newLine(); $this->output->writeln(sprintf('Vampires/Tombstones: %d/%d', $numUndead, $numUndead + $numDead)); $this->output->writeln(sprintf('Deleted tombstones: %d', $numDeleted)); foreach ($result->getPerFile() as $file => $fileResult) { $this->output->newLine(); $absoluteFilePath = PathTools::makePathAbsolute($file, $this->sourceDir); $this->output->writeln($absoluteFilePath); $this->displayVampires($fileResult->getUndead()); $this->displayTombstones($fileResult->getDead()); $this->displayDeleted($fileResult->getDeleted()); } }
/** * @param ResultDirectory $directory */ private function renderDirectory(ResultDirectory $directory) { $directoryPath = $directory->getPath(); $filesList = ''; foreach ($directory->getDirectories() as $subDir) { $name = $subDir->getName(); $link = './' . $subDir->getName() . '/index.html'; $filesList .= $this->renderDirectoryItem($name, $link, $subDir); } foreach ($directory->getFiles() as $fileResult) { $name = basename($fileResult->getFile()); $link = './' . $name . '.html'; $filesList .= $this->renderDirectoryItem($name, $link, $fileResult); } $this->directoryTemplate->setVar(array('path_to_root' => './' . str_repeat('../', substr_count($directoryPath, '/') + ($directoryPath ? 1 : 0)), 'full_path' => PathTools::makePathAbsolute($directoryPath, $this->sourceDir), 'breadcrumb' => $this->renderBreadcrumb($directoryPath), 'files_list' => $filesList, 'date' => date('r'), 'version' => Application::VERSION)); $reportFile = $this->reportDir . DIRECTORY_SEPARATOR . $directoryPath . '/index.html'; $reportDir = dirname($reportFile); if (!is_dir($reportDir)) { mkdir($reportDir, 0777, true); } $this->directoryTemplate->renderTo($reportFile); }