function File::renderBranchStructure
1 call to File::renderBranchStructure()
- 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 744
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 renderBranchStructure(FileNode $node) : string {
$branchesTemplate = new Template($this->templatePath . 'branches.html.dist', '{{', '}}');
$coverageData = $node->functionCoverageData();
$testData = $node->testData();
$codeLines = $this->loadFile($node->pathAsString());
$branches = '';
ksort($coverageData);
foreach ($coverageData as $methodName => $methodData) {
if (!$methodData['branches']) {
continue;
}
$branchStructure = '';
foreach ($methodData['branches'] as $branch) {
$branchStructure .= $this->renderBranchLines($branch, $codeLines, $testData);
}
if ($branchStructure !== '') {
// don't show empty branches
$branches .= '<h5 class="structure-heading"><a name="' . htmlspecialchars($methodName, $this->htmlSpecialCharsFlags) . '">' . $this->abbreviateMethodName($methodName) . '</a></h5>' . "\n";
$branches .= $branchStructure;
}
}
$branchesTemplate->setVar([
'branches' => $branches,
]);
return $branchesTemplate->render();
}