protected function printViolations(array $violations)
{
if (0 === count($violations)) {
return;
}
$table = new Table($this->output);
$table->setHeaders(array('#', 'Usage', 'Line', 'Comment'));
$tmpFile = null;
foreach ($violations as $i => $violation) {
if ($tmpFile !== $violation->getFile()) {
$tmpFile = $violation->getFile();
if (0 !== $i) {
$table->addRow(new TableSeparator());
}
$table->addRow($this->getFileHeader($tmpFile));
$table->addRow(new TableSeparator());
}
$table->addRow(array(++$i, $this->messageHelper->getViolationMessage($violation), $violation->getLine(), $violation->getComment()));
}
$table->render();
}