lithium\test\filter\Coverage::collect()
Collects code coverage analysis results from xdebug_get_code_coverage()
.
Parameters
-
array
$filterResults
An array of results arrays from
xdebug_get_code_coverage()
. -
array
$options
Set of options defining how results should be collected.
Returns
arrayThe packaged filter results.
Source
public static function collect($filterResults, array $options = []) {
$defaults = ['merging' => 'class'];
$options += $defaults;
$packagedResults = [];
foreach ($filterResults as $results) {
$class = key($results);
$results = $results[$class];
foreach ($results as $file => $lines) {
unset($results[$file][0]);
}
switch ($options['merging']) {
case 'class':
default:
if (!isset($packagedResults[$class])) {
$packagedResults[$class] = [];
}
$packagedResults[$class][] = $results;
break;
}
}
return $packagedResults;
}