function echo_title($title, $style = null) { $style = $style ?: 'title'; echo PHP_EOL; echo_style($style, $title . PHP_EOL); echo_style($style, str_repeat('~', strlen($title)) . PHP_EOL); echo PHP_EOL; }
function echo_block($style, $title, $message) { $message = ' ' . trim($message) . ' '; $width = strlen($message); echo PHP_EOL . PHP_EOL; echo_style($style, str_repeat(' ', $width) . PHP_EOL); echo_style($style, str_pad(' [' . $title . ']', $width, ' ', STR_PAD_RIGHT) . PHP_EOL); echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT) . PHP_EOL); echo_style($style, str_repeat(' ', $width) . PHP_EOL); }