protected function _renderMetricsReport($metricsReport, $labelWidth, $lineWidth, $depth)
{
$nbChilden = count($metricsReport);
$index = 0;
foreach ($metricsReport as $name => $data) {
$isLast = $index === $nbChilden - 1;
if ($isLast) {
$this->_prefixes[$depth] = '└──';
} else {
$this->_prefixes[$depth] = '├──';
}
$metrics = $data['metrics'];
$stats = $metrics->data();
$percent = number_format($stats['percent'], 2);
$style = $this->_style($percent);
$prefix = join('', $this->_prefixes) . ' ';
$diff = strlen($prefix) - strlen(utf8_decode($prefix));
$type = $metrics->type();
$color = $type === 'function' || $type === 'method' ? 'd' : '';
$this->write($prefix);
$this->write(str_pad($name, $labelWidth + $diff - strlen($prefix)), $color);
$this->write(' ');
$this->write(str_pad("{$stats['cloc']}", $lineWidth, ' ', STR_PAD_LEFT));
$this->write(' / ');
$this->write(str_pad("{$stats['lloc']}", $lineWidth, ' ', STR_PAD_LEFT));
$this->write(' ');
$this->write(str_pad("{$percent}%", 7, ' ', STR_PAD_LEFT), $style);
$this->write("\n");
if ($isLast) {
$this->_prefixes[$depth] = ' ';
} else {
$this->_prefixes[$depth] = '│ ';
}
$this->_renderMetricsReport($data['children'], $labelWidth, $lineWidth, $depth + 1);
$index++;
}
$this->_prefixes[$depth] = '';
}