yii\helpers\BaseConsole::confirm PHP Метод

confirm() публичный статический Метод

Asks user to confirm by typing y or n.
public static confirm ( string $message, boolean $default = false ) : boolean
$message string to print out before waiting for user input
$default boolean this value is returned if no selection is made.
Результат boolean whether user confirmed
    public static function confirm($message, $default = false)
    {
        while (true) {
            static::stdout($message . ' (yes|no) [' . ($default ? 'yes' : 'no') . ']:');
            $input = trim(static::stdin());
            if (empty($input)) {
                return $default;
            }
            if (!strcasecmp($input, 'y') || !strcasecmp($input, 'yes')) {
                return true;
            }
            if (!strcasecmp($input, 'n') || !strcasecmp($input, 'no')) {
                return false;
            }
        }
    }