function File::renderPathStructure
1 call to File::renderPathStructure()
- File::render in vendor/
phpunit/ php-code-coverage/ src/ Report/ Html/ Renderer/ File.php
File
-
vendor/
phpunit/ php-code-coverage/ src/ Report/ Html/ Renderer/ File.php, line 844
Class
- File
- @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Namespace
SebastianBergmann\CodeCoverage\Report\HtmlCode
private function renderPathStructure(FileNode $node) : string {
$pathsTemplate = new Template($this->templatePath . 'paths.html.dist', '{{', '}}');
$coverageData = $node->functionCoverageData();
$testData = $node->testData();
$codeLines = $this->loadFile($node->pathAsString());
$paths = '';
ksort($coverageData);
foreach ($coverageData as $methodName => $methodData) {
if (!$methodData['paths']) {
continue;
}
$pathStructure = '';
if (count($methodData['paths']) > 100) {
$pathStructure .= '<p>' . count($methodData['paths']) . ' is too many paths to sensibly render, consider refactoring your code to bring this number down.</p>';
continue;
}
foreach ($methodData['paths'] as $path) {
$pathStructure .= $this->renderPathLines($path, $methodData['branches'], $codeLines, $testData);
}
if ($pathStructure !== '') {
$paths .= '<h5 class="structure-heading"><a name="' . htmlspecialchars($methodName, $this->htmlSpecialCharsFlags) . '">' . $this->abbreviateMethodName($methodName) . '</a></h5>' . "\n";
$paths .= $pathStructure;
}
}
$pathsTemplate->setVar([
'paths' => $paths,
]);
return $pathsTemplate->render();
}