concrete/src/Console/OutputStyle.php
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);
    }
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);
    }
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 ) ; }
Ask a question with autocompletion

@param $question
@param array $choices
@param null $default
@param null $attempts
@param bool $strict
@return string
Ask a question with autocompletion