src/Composer/IO/ConsoleIO.php
public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
    {
        /** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
        $helper = $this->helperSet->get('question');
        $question = new ChoiceQuestion($question, $choices, $default);
        $question->setMaxAttempts($attempts ?: null); // IOInterface requires false, and Question requires null or int
        $question->setErrorMessage($errorMessage);
        $question->setMultiselect($multiselect);

        $result = $helper->ask($this->input, $this->getErrorOutput(), $question);

        if (!is_array($result)) {
            return (string) array_search($result, $choices, true);
        }

        $results = array();
        foreach ($choices as $index => $choice) {
            if (in_array($choice, $result, true)) {
                $results[] = (string) $index;
            }
        }

        return $results;
    }
public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
    {
        /** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
        $helper = $this->helperSet->get('question');
        $question = new ChoiceQuestion($question, $choices, $default);
        $question->setMaxAttempts($attempts ?: null); // IOInterface requires false, and Question requires null or int
        $question->setErrorMessage($errorMessage);
        $question->setMultiselect($multiselect);

        $result = $helper->ask($this->input, $this->getErrorOutput(), $question);

        if (!is_array($result)) {
            return (string) array_search($result, $choices, true);
        }

        $results = array();
        foreach ($choices as $index => $choice) {
            if (in_array($choice, $result, true)) {
                $results[] = (string) $index;
            }
        }

        return $results;
    }
public function select ( $ question , $ choices , $ default , $ attempts = false , $ errorMessage = 'Value "%s" is invalid' , $ multiselect = false ) { /** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */ $ helper = $ this -> helperSet -> get ( 'question' ) ; $ question = new ChoiceQuestion ( $ question , $ choices , $ default ) ; $ question -> setMaxAttempts ( $ attempts ? : null ) ; // IOInterface requires false, and Question requires null or int $ question -> setErrorMessage ( $ errorMessage ) ; $ question -> setMultiselect ( $ multiselect ) ; $ result = $ helper -> ask ( $ this -> input , $ this -> getErrorOutput ( ) , $ question ) ; if ( ! is_array ( $ result ) ) { return ( string ) array_search ( $ result , $ choices , true ) ; } $ results = array ( ) ; foreach ( $ choices as $ index => $ choice ) { if ( in_array ( $ choice , $ result , true ) ) { $ results [ ] = ( string ) $ index ; } } return $ results ; }
{@inheritDoc}
{