public function askQuestion(InteractiveQuestion $question, $position = null, InputInterface $input = null)
{
$text = ($position !== null ? $position . ') ' : null) . $question->getFormatedText();
if ($this->dialogHelper instanceof QuestionHelper) {
if (!$input) {
throw new \InvalidArgumentException('With symfony 3, the input stream may not be null');
}
$q = new Question($text, $question->getDefault());
$q->setValidator($question->getValidator());
if ($question->isHiddenAnswer()) {
$q->setHidden(true);
}
return $this->dialogHelper->ask($input, $this, $q);
}
if ($this->dialogHelper instanceof DialogHelper) {
if ($question->isHiddenAnswer()) {
return $this->dialogHelper->askHiddenResponseAndValidate($this, $text, $question->getValidator(), false);
}
return $this->dialogHelper->askAndValidate($this, $text, $question->getValidator(), false, $question->getDefault());
}
throw new \RuntimeException("Invalid dialogHelper");
}