public static function toThrowableString($ex)
{
$stack = [];
$i = 0;
$trace = static::toThrowableTrace($ex);
$pad = strlen(count($trace)) > 2 ?: 2;
foreach ($trace as $element) {
$stack[] = "\t" . str_pad('' . $i, $pad, ' ', STR_PAD_LEFT) . '. ' . $element;
++$i;
}
return implode("\n", $stack);
}