protected function isValidChoice($choice, array $choices, bool $case)
    {
        if ($this->isAssocChoice($choices)) {
            $choices = \array_keys($choices);
        }

        $fn = ['\strcasecmp', '\strcmp'][(int) $case];

        foreach ($choices as $option) {
            if ($fn($choice, $option) == 0) {
                return true;
            }
        }

        return false;
    }
protected function isValidChoice($choice, array $choices, bool $case)
    {
        if ($this->isAssocChoice($choices)) {
            $choices = \array_keys($choices);
        }

        $fn = ['\strcasecmp', '\strcmp'][(int) $case];

        foreach ($choices as $option) {
            if ($fn($choice, $option) == 0) {
                return true;
            }
        }

        return false;
    }
protected function isValidChoice ( $ choice , array $ choices , bool $ case ) { if ( $ this -> isAssocChoice ( $ choices ) ) { $ choices = \ array_keys ( $ choices ) ; } $ fn = [ '\strcasecmp' , '\strcmp' ] [ ( int ) $ case ] ; foreach ( $ choices as $ option ) { if ( $ fn ( $ choice , $ option ) == 0 ) { return true ; } } return false ; }
Check if user choice is one of possible choices.

@param string $choice  User choice.
@param array  $choices Possible choices.
@param bool   $case    If input is case sensitive.

@return bool
Check if user choice is one of possible choices .