protected static function showException(\Exception $e, Config $config = null)
{
echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
if (method_exists($e, 'getExtra')) {
$extra = $e->getExtra();
if (is_array($extra)) {
if (isset($extra['file'])) {
echo PHP_EOL;
$lines = file($extra['file']);
if (isset($lines[$extra['line'] - 1])) {
$line = $lines[$extra['line'] - 1];
echo "\t", str_replace("\t", " ", $line);
if ($extra['char'] - 1 > 0) {
echo "\t", str_repeat("-", $extra['char'] - 1), "^", PHP_EOL;
}
}
}
}
}
echo PHP_EOL;
if ($config && $config->get('verbose')) {
echo 'at ', str_replace(ZEPHIRPATH, '', $e->getFile()), '(', $e->getLine(), ')', PHP_EOL;
echo str_replace(ZEPHIRPATH, '', $e->getTraceAsString()), PHP_EOL;
}
exit(1);
}