Ejemplo n.º 1
0
 /**
  * Constructor.
  *
  * @param string $question The question to ask to the user
  * @param array $choices The list of available choices
  * @param mixed $default The default answer to return
  */
 public function __construct($question, array $choices, $default = null)
 {
     parent::__construct($question, $default);
     $this->choices = $choices;
     $this->setValidator($this->getDefaultValidator());
     $this->setAutocompleterValues($choices);
 }
Ejemplo n.º 2
0
 /**
  * Modify our question on construct to apply some pretty formatting.
  *
  * @param   string  $question   The question to ask to the user
  * @param   mixed   $default    The default answer to return if the user enters nothing
  */
 public function __construct($question, $default = NULL)
 {
     // Append our default value?
     if ($default !== NULL) {
         $question = $question . " <comment>[default: \"{$default}\"]</comment>";
     }
     $question = $question . ': ';
     parent::__construct($question, $default);
 }
Ejemplo n.º 3
0
 /**
  *
  * @param string $question The question to be asked
  * @param string|null $default the default (optional)
  */
 public function __construct(string $question, string $default = null)
 {
     parent::__construct($question, $default);
     $this->setFormatter(new formatter\WithDefault());
 }
 public function __construct($question, array $rules, $default = null)
 {
     parent::__construct($question, $default);
     $this->rules = $rules;
     $this->setValidator($this->validator());
 }