function File::renderFunctionOrMethodItem
2 calls to File::renderFunctionOrMethodItem()
- File::renderFunctionItems in vendor/
phpunit/ php-code-coverage/ src/ Report/ Html/ Renderer/ File.php - File::renderTraitOrClassItems 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 435
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 renderFunctionOrMethodItem(Template $template, array $item, string $indent = '') : string {
$numMethods = 0;
$numTestedMethods = 0;
if ($item['executableLines'] > 0) {
$numMethods = 1;
if ($item['executedLines'] === $item['executableLines']) {
$numTestedMethods = 1;
}
}
$executedLinesPercentage = Percentage::fromFractionAndTotal($item['executedLines'], $item['executableLines']);
$executedBranchesPercentage = Percentage::fromFractionAndTotal($item['executedBranches'], $item['executableBranches']);
$executedPathsPercentage = Percentage::fromFractionAndTotal($item['executedPaths'], $item['executablePaths']);
$testedMethodsPercentage = Percentage::fromFractionAndTotal($numTestedMethods, 1);
return $this->renderItemTemplate($template, [
'name' => sprintf('%s<a href="#%d"><abbr title="%s">%s</abbr></a>', $indent, $item['startLine'], htmlspecialchars($item['signature'], $this->htmlSpecialCharsFlags), $item['functionName'] ?? $item['methodName']),
'numMethods' => $numMethods,
'numTestedMethods' => $numTestedMethods,
'linesExecutedPercent' => $executedLinesPercentage->asFloat(),
'linesExecutedPercentAsString' => $executedLinesPercentage->asString(),
'numExecutedLines' => $item['executedLines'],
'numExecutableLines' => $item['executableLines'],
'branchesExecutedPercent' => $executedBranchesPercentage->asFloat(),
'branchesExecutedPercentAsString' => $executedBranchesPercentage->asString(),
'numExecutedBranches' => $item['executedBranches'],
'numExecutableBranches' => $item['executableBranches'],
'pathsExecutedPercent' => $executedPathsPercentage->asFloat(),
'pathsExecutedPercentAsString' => $executedPathsPercentage->asString(),
'numExecutedPaths' => $item['executedPaths'],
'numExecutablePaths' => $item['executablePaths'],
'testedMethodsPercent' => $testedMethodsPercentage->asFloat(),
'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(),
'crap' => $item['crap'],
]);
}