/** * Outputs the coverage report of a metrics instance. * * @param Metrics $metrics A metrics instance. */ protected function _renderCoverage($metrics) { $stats = $metrics->data(); foreach ($stats['files'] as $file) { $this->write("File: {$file}" . "\n\n"); $lines = file($file); $coverage = $this->_collector->export($file); if (isset($stats['line'])) { $start = $stats['line']['start']; $stop = $stats['line']['stop']; } else { $start = 0; $stop = count($lines) - 1; } for ($i = $start; $i <= $stop; $i++) { $value = isset($coverage[$i]) ? $coverage[$i] : null; $line = str_pad($i + 1, 6, ' ', STR_PAD_LEFT); $line .= ':' . str_pad($value, 6, ' '); $line .= $lines[$i]; if ($value) { $this->write($line, 'n;green'); } elseif ($value === 0) { $this->write($line, 'n;red'); } else { $this->write($line); } } $this->write("\n\n"); } }