Prompts the user for a response
@param string $question the question to ask
@param string $choices the available choices
@param string $default the default choice when no input is entered
@return string the choice
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;
	}
827898
public function ask($question, $verbosity = null, $default = null, array $args = [])
    {
        $message    =   $this->interpolate($question, $args);
        return parent::ask($message, $default);
    }
846633
public function confirmation($message, $choices = ['y' => true, 'n' => false], $default = false)
    {
        $message = is_array($message) ? call_user_func_array('sprintf', $message) : $message;

        $answers = [];
        foreach ($choices as $answer => $value) {
            $answers[$answer] = $answer;
            if ($value === $default) $answers[$answer] = ucfirst($answer);
        }
        
        $this->send(sprintf('%s [%s]: ', $message, join('/', $answers)), '');
        $answer = $this->readline();
        if ($answer === '') return $default;

        if (array_key_exists($answer, $choices)) {
            return $choices[$answer];
        } else {
            foreach ($choices as $key => $value) {
                if ($answer === substr($key, 0, strlen($answer))) return $value;
            }
            return $default;
        }
    }
732766
public function confirm($question, $default = false)
    {
        $que = new ConfirmationQuestion($question, $default);
        $helper = new SymfonyQuestionHelper();
        return $helper->ask($this->input, $this->output, $que);
    }
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);
    }
129295
public function ask($question)
    {
        //Show required message
        echo "\n";
        echo "\t", $this->colorize($question, 'info');
        echo "\n";
        //Get user input
        echo "\t"; $response = trim(fgets(STDIN));

        return $response;
    }
188263
protected function setQuestionDefault(Question $question, $default_value) {
    if ($question instanceof ChoiceQuestion) {
      $question->__construct($question->getQuestion(), $question->getChoices(), $default_value);
    }
    else {
      $question->__construct($question->getQuestion(), $default_value);
    }
  }
680613
protected function askUser($question, $defaultValue = '')
    {
        if ($this->option('interactive')) {
            return $this->ask($question, $defaultValue);
        }

        return $defaultValue;
    }
369116
public static function question(string $question, string $default = '', \Closure $validator = null): string
    {
        return Question::ask($question, $default, $validator);
    }
516774
function Prompt( question, rl, answers ) {

  // Setup instance defaults property
  _.assign( this, {
    height : 0,
    status : "pending"
  });

  // Set defaults prompt options
  this.opt = _.defaults( _.clone(question), {
    validate: function() { return true; },
    filter: function( val ) { return val; },
    when: function() { return true; }
  });

  // Check to make sure prompt requirements are there
  if (!this.opt.message) {
    this.throwParamError("message");
  }
  if (!this.opt.name) {
    this.throwParamError("name");
  }

  // Normalize choices
  if ( _.isArray(this.opt.choices) ) {
    this.opt.choices = new Choices( this.opt.choices, answers );
  }

  this.rl = rl;

  return this;
}
1303389
protected function askNumeric( $question, $default = null ) {
		$ask = 'Your answer needs to be a numeric value';

		if ( ! is_null( $default ) ) {
			$question .= ' [Default: '. $default .'] ';
			$ask .= ' or blank for default';
		}

		$answer = $this->ask( $question );

		while ( ! is_numeric( $answer ) and ! ( $answer == '' and ! is_null( $default ) ) ) {
			$answer = $this->ask( $ask .'. ');
		}
		if ( $answer == '' ) {
			$answer = $default;
		}
		return $answer;
	}
482667
public function ask($choice = null)
    {
        $responseCollection         = new PredefinedResponseCollection();
        $sourceConfiguredCollection = $this->metadataSourceConfigDAO->retrieveAll();

        if ($sourceConfiguredCollection->count() === 0) {
            throw new \Exception('You must config a metadataSource');
        }

        foreach ($sourceConfiguredCollection as $backend) {
            /* @var $backend \CrudGenerator\Metadata\MetaDataSource */
            if (null === $backend->getFalseDependencies()) {
                $responseCollection->append(
                    new PredefinedResponse($backend->getUniqueName(), $backend->getUniqueName(), $backend)
                );
            }
        }

        $question = new QuestionWithPredefinedResponse(
            "Select configured source",
            self::QUESTION_KEY,
            $responseCollection
        );
        $question->setPreselectedResponse($choice);
        $question->setShutdownWithoutResponse(true);

        return $this->context->askCollection($question);
    }
608679
public function ask(string $name, string $question, string $default = '', bool $required = false)
    {
        $count = 0;
        $maxAsks = 3;

        while ($count++ < $maxAsks) {
            $response = $this->in($question, $default);

            if (!$required || !empty($response)) {
                return $response;
            }

            $this->handler->out('A response is required...');
        }

        throw new AskException($name, $maxAsks);
    }
517822
public function getQuestionConfirm(
        $question,
        $default = 'y',
        array $options = array('y', 'n'),
        $required = true
    ) {
        return $this->getQuestion($question, $default, $options, $required);
    }
930523
public function ask($question, $default = null)
    {
        $question = new Question("<question>$question</question> ", $default);

        return $this->helper('question')->ask($this->input, $this->output, $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);
    }
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);
    }