function RawCodeCoverageData::keepFunctionCoverageDataOnlyForLines
Parameters
int[] $lines:
File
-
vendor/
phpunit/ php-code-coverage/ src/ Data/ RawCodeCoverageData.php, line 190
Class
- RawCodeCoverageData
- @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Namespace
SebastianBergmann\CodeCoverage\DataCode
public function keepFunctionCoverageDataOnlyForLines(string $filename, array $lines) : void {
if (!isset($this->functionCoverage[$filename])) {
return;
}
foreach ($this->functionCoverage[$filename] as $functionName => $functionData) {
foreach ($functionData['branches'] as $branchId => $branch) {
if (count(array_diff(range($branch['line_start'], $branch['line_end']), $lines)) > 0) {
unset($this->functionCoverage[$filename][$functionName]['branches'][$branchId]);
foreach ($functionData['paths'] as $pathId => $path) {
if (in_array($branchId, $path['path'], true)) {
unset($this->functionCoverage[$filename][$functionName]['paths'][$pathId]);
}
}
}
}
}
}