*/ function input( string $message ) { error_log($message); $handle = fopen('php://stdin','r'); $input = fgets($handle); return $input; } /** * @author Christian Fraß */ function confirm( string $message ) { return (trim(input($message . ' [y/n]')) === 'y'); } /** * halts the excution until ENTER is pressed * * @author Christian Fraß */ function pause( ) { error_log('-- PAUSED -- press to continue'); $handle = fopen('php://stdin','r'); fgets($handle); } /** * wraps a procedure with try-catch * * @author Christian Fraß */ function soften( \Closure $procedure, bool $silent = false ) : void { try { $procedure(); } catch (\Throwable $throwable) { if (! $silent) { error_log(strval($throwable)); } } } ?>