function Builder::buildDirectoryStructure
Builds an array representation of the directory structure.
For instance,
<code> Array ( [Money.php] => Array ( ... )
[MoneyBag.php] => Array ( ... ) ) </code>
is transformed into
<code> Array ( [.] => Array ( [Money.php] => Array ( ... )
[MoneyBag.php] => Array ( ... ) ) ) </code>
@psalm-return array<string, array<string, array{lineCoverage: array<int, int>, functionCoverage: array<string, array<int, int>>}>>
1 call to Builder::buildDirectoryStructure()
- Builder::build in vendor/
phpunit/ php-code-coverage/ src/ Node/ Builder.php
File
-
vendor/
phpunit/ php-code-coverage/ src/ Node/ Builder.php, line 137
Class
- Builder
- @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Namespace
SebastianBergmann\CodeCoverage\NodeCode
private function buildDirectoryStructure(ProcessedCodeCoverageData $data) : array {
$result = [];
foreach ($data->coveredFiles() as $originalPath) {
$path = explode(DIRECTORY_SEPARATOR, $originalPath);
$pointer =& $result;
$max = count($path);
for ($i = 0; $i < $max; $i++) {
$type = '';
if ($i === $max - 1) {
$type = '/f';
}
$pointer =& $pointer[$path[$i] . $type];
}
$pointer = [
'lineCoverage' => $data->lineCoverage()[$originalPath] ?? [],
'functionCoverage' => $data->functionCoverage()[$originalPath] ?? [],
];
}
return $result;
}