alias of the `question()`
@param string   $question question message
@param string   $default default value
@param \Closure $validator The validate callback. It must return bool.
@return string|null
511682
public static function ask(string $question, string $default = '', \Closure $validator = null): ?string
    {
        return self::question($question, $default, $validator);
    }
175790
protected function askQuestion($question, $choices, $default)
	{
		// Ask until we get a valid response
		do
		{
			echo $question.' '.$choices.': ';
			
			$handle = fopen("php://stdin", "r");
			$line = fgets($handle);

			$response = trim($line);

			// Use default when no response is given
			if (empty($response))
				$response = $default;
		}
		while (!in_array($response, explode('/', $choices)));

		return $response;
	}
64998
final protected function askInput($question, $defaultValue)
    {
        $indent = ($this->indent > 0) ? $this->indent : 0;
        $prompt = empty($defaultValue) && 0 !== $defaultValue ? '' : sprintf(' [<info>%s</info>]', $defaultValue);
        $question = sprintf('%s%s%s: ', str_repeat(' ', 4 * $indent), $question, $prompt);

        $question = new Question($question, $defaultValue);
        return $this->getHelper('question')->ask($this->input, $this->output, $question);
    }
353539
public function ask(string $question, $default = 'n', ?array $options = null)
	{
		$options = $options === null ? ['y' => true, 'n' => false] : $this->normalizeKeys($options);

		$input = parent::ask(trim($question) . ' [' . $this->getOptions($options, $default) . '] ');

		$input = mb_strtolower(empty($input) ? $default : $input);

		if(!isset($options[$input]))
		{
			return $this->ask($question, $default, $options);
		}

		return $options[$input];
	}
1344427
public function confirm($question, $default = true)
	{
		$dialog = $this->getHelperSet()->get('dialog');

		return $dialog->askConfirmation($this->output, "<question>$question</question>", $default);
	}
453918
public function choose($question, array $options, $default, $error_message)
	{
		/** @var QuestionHelper $helper */
		$helper = $this->_helperSet->get('question');
		$choice_question = new ChoiceQuestion('<question>' . $question . '</question> ', $options, $default);
		$choice_question->setErrorMessage($error_message);

		return $helper->ask($this->_input, $this->_output, $choice_question);
	}
35557
public function validationDefault(Validator $validator) {
        $validator
                ->add('id', 'valid', ['rule' => 'numeric'])
                ->allowEmpty('id', 'create')
                ->add('sys_user', 'valid', ['rule' => 'numeric'])
                ->allowEmpty('sys_user')
                ->add('sys_role', 'valid', ['rule' => 'numeric'])
                ->allowEmpty('sys_role')
                ->add('allow', 'valid', ['rule' => 'boolean'])
                ->allowEmpty('allow');

        return $validator;
    }
900495
public function confirm($questionText, $default = true)
    {
        $questionText .= ' <question>' . ($default ? '[Y/n]' : '[y/N]') . '</question> ';

        $yes = $this->input->hasOption('yes') && $this->input->getOption('yes');
        $no = $this->input->hasOption('no') && $this->input->getOption('no');
        if ($yes && !$no) {
            $this->output->writeln($questionText . 'y');
            return true;
        } elseif ($no && !$yes) {
            $this->output->writeln($questionText . 'n');
            return false;
        } elseif (!$this->input->isInteractive()) {
            $this->output->writeln($questionText . ($default ? 'y' : 'n'));
            return $default;
        }
        $question = new ConfirmationQuestion($questionText, $default);

        return $this->ask($this->input, $this->output, $question);
    }
1168993
private function askAndValidate(InputInterface $input, OutputInterface $output, $questionText, $default, $validator)
    {
        $questionHelper = $this->getQuestionHelper();

        // NEXT_MAJOR: Remove this BC code for SensioGeneratorBundle 2.3/2.4 after dropping support for Symfony 2.3
        if ($questionHelper instanceof DialogHelper) {
            return $questionHelper->askAndValidate($output, $questionHelper->getQuestion($questionText, $default), $validator, false, $default);
        }

        $question = new Question($questionHelper->getQuestion($questionText, $default), $default);

        $question->setValidator($validator);

        return $questionHelper->ask($input, $output, $question);
    }
463268
public function askWithCompletion($question, array $choices, $default = null)
    {
        $question = new Question($question, $default);

        $question->setAutocompleterValues($choices);

        return $this->output->askQuestion($question);
    }
136107
public function optionOrAsk($option, $question, $default = null)
    {
        $value = $this->input->getOption($option);
        if ($value === null || Str::likeEmpty($value)) {
            $value = $this->ask($question, $default);
        }

        return $value;
    }
1268987
protected function secret(string $question, $default = null, bool $fallback = false)
	{
		return (new Secret($this->input, $this->output))->ask($question, $default, $fallback);
	}
338535
public function validationDefault(Validator $validator)
    {
        $validator
            ->uuid('id')
            ->allowEmpty('id', 'create');

        $validator
            ->dateTime('trashed')
            ->allowEmpty('trashed');

        $validator
            ->scalar('response_status')
            ->maxLength('response_status', 255)
            ->allowEmpty('response_status');

        return $validator;
    }
1225507
public function askWithCompletion($question, array $choices, $default = null, $attempts = null, $strict = false)
    {
        $question = new Question($question, $default);
        $question->setMaxAttempts($attempts)->setAutocompleterValues($choices);

        if ($strict) {
            $question->setValidator(function($result) use ($choices) {
                if (!in_array($result, $choices)) {
                    throw new \InvalidArgumentException(sprintf(
                        'The provided answer is ambiguous. Value should be one of %s',
                        implode(' or ', $choices)));
                }

                return $result;
            });
        }

        return $this->askQuestion($question);
    }
1049234
public function ask(string $prompt, array $validAnswers = [], string $default = null)
    {
        if ($validAnswers) {
            $answers = [];
            foreach ($validAnswers as $v) {
                if ($default && $default === $v) {
                    $answers[] = '[' . $v . ']';
                } else {
                    $answers[] = $v;
                }
            }
            $prompt .= ' (' . implode('/', $answers) . ')';
        }

        $prompt .= ' ';

        if ($this->style) {
            echo $this->formatter->getStartMark($this->style);
        }

        $answer = null;
        while (true) {
            $answer = trim($this->console->readLine($prompt));
            if ($validAnswers) {
                if (in_array($answer, $validAnswers, true)) {
                    break;
                }

                if (trim($answer) === '' && $default) {
                    $answer = $default;
                    break;
                }
                continue;
            }
            break;
        }

        if ($this->style) {
            echo $this->formatter->getClearMark();
        }

        return $answer;
    }
26254
public function choice($question, array $choices, $default = null)
    {
        if ($default) {
            $values = array_flip($choices);
            $default = $values[$default];
        }

        $question = new ChoiceQuestion($question, $choices, $default);
        $question->setMultiselect(true);

        return $this->askQuestion($question);
    }
467509
private function askQuestion($message, $choices, $default)
    {
        $this->output->writeln('');
        $helper = new QuestionHelper();
        $question = new ChoiceQuestion(' ' . $message . "\n", $choices, $default);

        return $helper->ask($this->input, $this->output, $question);
    }