public function choose($question, $choice = 'yn', $default = 'n')
    {
        if (!is_string($choice)) {
            $choice = implode('', $choice);
        }

        $lowercase = str_ireplace($default, strtoupper($default), strtolower($choice));
        $choices = trim(implode('/', preg_split('//', $lowercase)), '/');
        $line = $this->prompt(sprintf('%s [%s]', $question, $choices), $default, '');

        if (stripos($choice, $line) !== false) {
            return strtolower($line);
        }

        return strtolower($default);
    }
public function choose($question, $choice = 'yn', $default = 'n')
    {
        if (!is_string($choice)) {
            $choice = implode('', $choice);
        }

        $lowercase = str_ireplace($default, strtoupper($default), strtolower($choice));
        $choices = trim(implode('/', preg_split('//', $lowercase)), '/');
        $line = $this->prompt(sprintf('%s [%s]', $question, $choices), $default, '');

        if (stripos($choice, $line) !== false) {
            return strtolower($line);
        }

        return strtolower($default);
    }
public function choose ( $ question , $ choice = 'yn' , $ default = 'n' ) { if ( ! is_string ( $ choice ) ) { $ choice = implode ( '' , $ choice ) ; } $ lowercase = str_ireplace ( $ default , strtoupper ( $ default ) , strtolower ( $ choice ) ) ; $ choices = trim ( implode ( '/' , preg_split ( '//' , $ lowercase ) ) , '/' ) ; $ line = $ this -> prompt ( sprintf ( '%s [%s]' , $ question , $ choices ) , $ default , '' ) ; if ( stripos ( $ choice , $ line ) !== false ) { return strtolower ( $ line ) ; } return strtolower ( $ default ) ; }
Presents a user with a multiple choice questions
@param string $question
@param string|array $choice
@param string $default
@return string
Presents a user with a multiple choice questions