private function printBox(IO $io, Exception $exception)
{
$screenWidth = $io->getTerminalDimensions()->getWidth() - 1;
$boxWidth = 0;
$boxLines = array_merge(array(sprintf('[%s]', get_class($exception))), explode("\n", wordwrap($exception->getMessage(), $screenWidth - 4)));
foreach ($boxLines as $line) {
$boxWidth = max($boxWidth, strlen($line));
}
// TODO handle $boxWidth > $screenWidth
$emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $boxWidth + 4));
$io->errorLine('');
$io->errorLine('');
$io->errorLine($emptyLine);
foreach ($boxLines as $boxLine) {
$padding = str_repeat(' ', max(0, $boxWidth - strlen($boxLine)));
$io->errorLine(sprintf('<error> %s%s </error>', $boxLine, $padding));
}
$io->errorLine($emptyLine);
$io->errorLine('');
$io->errorLine('');
}