$lines) { foreach ($lines as $line => $status) { if (!isset($merged[$file][$line]) || $status === 1) { $merged[$file][$line] = ($status === 1 || ($merged[$file][$line] ?? -1) === 1) ? 1 : $status; } } } } $targets = array_slice($argv, 1); if (!$targets) { $targets = array_keys($merged); } $grandTotal = 0; $grandHit = 0; foreach ($targets as $target) { $target = realpath($target) ?: $target; $lines = $merged[$target] ?? []; $exec = []; $hit = []; foreach ($lines as $line => $status) { if ($status === -2) { continue; // dead code } $exec[$line] = true; if ($status === 1) { $hit[$line] = true; } } $total = count($exec); $covered = count($hit); $grandTotal += $total; $grandHit += $covered; $pct = $total > 0 ? round($covered * 100 / $total, 1) : 0.0; $missing = array_diff(array_keys($exec), array_keys($hit)); sort($missing); printf("%6.1f%% %3d/%-3d %s\n", $pct, $covered, $total, str_replace(getcwd() . '/', '', $target)); if ($missing && getenv('SHOW_MISSING')) { echo ' manquantes: ' . implode(', ', $missing) . "\n"; } } if ($grandTotal > 0) { printf("\nTOTAL: %d/%d (%.1f%%)\n", $grandHit, $grandTotal, $grandHit * 100 / $grandTotal); } echo 'dumps: ' . count($files) . "\n";