public function choices(string $text, array $choices, $default = null, bool $case = false)
    {
        $this->writer->yellow($text);

        $this->listOptions($choices, $default, true);

        $choice = $this->reader->read($default);

        if (\is_string($choice)) {
            $choice = \explode(',', \str_replace(' ', '', $choice));
        }

        $valid = [];

        foreach ($choice as $option) {
            if ($this->isValidChoice($option, $choices, $case)) {
                $valid[] = $option;
            }
        }

        return $valid ?: (array) $default;
    }
public function choices(string $text, array $choices, $default = null, bool $case = false)
    {
        $this->writer->yellow($text);

        $this->listOptions($choices, $default, true);

        $choice = $this->reader->read($default);

        if (\is_string($choice)) {
            $choice = \explode(',', \str_replace(' ', '', $choice));
        }

        $valid = [];

        foreach ($choice as $option) {
            if ($this->isValidChoice($option, $choices, $case)) {
                $valid[] = $option;
            }
        }

        return $valid ?: (array) $default;
    }
public function choices ( string $ text , array $ choices , $ default = null , bool $ case = false ) { $ this -> writer -> yellow ( $ text ) ; $ this -> listOptions ( $ choices , $ default , true ) ; $ choice = $ this -> reader -> read ( $ default ) ; if ( \ is_string ( $ choice ) ) { $ choice = \ explode ( ',' , \ str_replace ( ' ' , '' , $ choice ) ) ; } $ valid = [ ] ; foreach ( $ choice as $ option ) { if ( $ this -> isValidChoice ( $ option , $ choices , $ case ) ) { $ valid [ ] = $ option ; } } return $ valid ? : ( array ) $ default ; }
Let user make multiple choices out of available choices.

@param string $text    Prompt text.
@param array  $choices Possible choices for user.
@param mixed  $default Default value- if not chosen or invalid.
@param bool   $case    If user input should be case sensitive.

@return mixed User input or default.
Let user make multiple choices out of available choices .