Xdebug has to be enabled.\n"; } elseif ($_GET["coverage"] === "0") { file_put_contents($coverage_filename, serialize(array())); echo "
$prev_color = null; $s = ""; echo "";
for ($l=0; $l <= count($file); $l++) {
$line = $file[$l];
$color = "#C0FFC0"; // tested
switch ($coverage[realpath($filename)][$l+1] ?? null) {
case -1: // untested
$color = "#FFC0C0";
break;
case -2: // dead code
$color = "Silver";
break;
case null: // not executable
$color = "";
break;
}
if ($prev_color === null) {
$prev_color = $color;
}
if ($prev_color != $color || $line === null) {
echo "$s";
$open_tags = xhtml_open_tags($s);
foreach (array_reverse($open_tags) as $tag) {
echo "" . preg_replace('~ .*~', '', $tag) . ">";
}
echo "";
$s = ($open_tags ? "<" . implode("><", $open_tags) . ">" : "");
$prev_color = $color;
}
$s .= "$line\n";
}
echo "";
} else {
if (file_exists($coverage_filename)) {
// display list of files
$coverage = unserialize(file_get_contents($coverage_filename));
echo "| $ratio% | $filename\n"; } echo " |
Start new coverage\n"; }