ask() public method

Prompts the user for input, and returns it.
public ask ( string $prompt, string | null $default = null ) : mixed
$prompt string Prompt text.
$default string | null Default input value.
return mixed Either the default value, or the user-provided input.
Example #1
0
 /**
  * Prompts the user for input, and returns it.
  *
  * @param string $prompt Prompt text.
  * @param string|array|null $options Array or string of options.
  * @param string|null $default Default input value.
  * @return mixed Either the default value, or the user-provided input.
  * @link http://book.cakephp.org/3.0/en/console-and-shells.html#Shell::in
  */
 public function in($prompt, $options = null, $default = null)
 {
     if (!$this->interactive) {
         return $default;
     }
     if ($options) {
         return $this->_io->askChoice($prompt, $options, $default);
     }
     return $this->_io->ask($prompt, $default);
 }