function Dashboard::render
File
-
vendor/
phpunit/ php-code-coverage/ src/ Report/ Html/ Renderer/ Dashboard.php, line 32
Class
- Dashboard
- @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Namespace
SebastianBergmann\CodeCoverage\Report\HtmlCode
public function render(DirectoryNode $node, string $file) : void {
$classes = $node->classesAndTraits();
$templateName = $this->templatePath . ($this->hasBranchCoverage ? 'dashboard_branch.html' : 'dashboard.html');
$template = new Template($templateName, '{{', '}}');
$this->setCommonTemplateVariables($template, $node);
$baseLink = $node->id() . '/';
$complexity = $this->complexity($classes, $baseLink);
$coverageDistribution = $this->coverageDistribution($classes);
$insufficientCoverage = $this->insufficientCoverage($classes, $baseLink);
$projectRisks = $this->projectRisks($classes, $baseLink);
$template->setVar([
'insufficient_coverage_classes' => $insufficientCoverage['class'],
'insufficient_coverage_methods' => $insufficientCoverage['method'],
'project_risks_classes' => $projectRisks['class'],
'project_risks_methods' => $projectRisks['method'],
'complexity_class' => $complexity['class'],
'complexity_method' => $complexity['method'],
'class_coverage_distribution' => $coverageDistribution['class'],
'method_coverage_distribution' => $coverageDistribution['method'],
]);
try {
$template->renderTo($file);
} catch (Exception $e) {
throw new FileCouldNotBeWrittenException($e->getMessage(), $e->getCode(), $e);
}
}