write($title); $length = function_exists('mb_strlen') ? mb_strlen($title) : strlen($title); // 8 is the length of the label + 2 let it breathe $padding = $width - $length - 10; try { $response = $closure(); } catch (\Exception $e) { $output->writeln(str_pad(' ', $padding) . '[ FAIL ]'); throw $e; } $output->writeln(str_pad(' ', $padding) . '[ OK ]'); return $response; } }