src/Str.php
public static function isOneOf($input, array $values, $caseInsensitive = false, $returnIndex = false)
    {
        if (is_null($input)) {
            return false;
        }

        foreach ($values as $index => $str) {
            if (static::equals($input, $str, $caseInsensitive)) {
                return ($returnIndex) ? $index : true;
            }
        }

        return false;
    }
public static function isOneOf($input, array $values, $caseInsensitive = false, $returnIndex = false)
    {
        if (is_null($input)) {
            return false;
        }

        foreach ($values as $index => $str) {
            if (static::equals($input, $str, $caseInsensitive)) {
                return ($returnIndex) ? $index : true;
            }
        }

        return false;
    }
public static function isOneOf ( $ input , array $ values , $ caseInsensitive = false , $ returnIndex = false ) { if ( is_null ( $ input ) ) { return false ; } foreach ( $ values as $ index => $ str ) { if ( static :: equals ( $ input , $ str , $ caseInsensitive ) ) { return ( $ returnIndex ) ? $ index : true ; } } return false ; }
Verifies if the input string is one of the values of the given array.

Verifies if the input string is one of the values of the given array. Each of the values
of the array is matched against the input string. The index of the value that matched can
be returned instead of the default bool value. The comparison can be case sensitive or
case insensitive.

@param  string $input           The input string
@param  array  $values          The string|PrimitiveString array to look for the input string
@param  bool   $caseInsensitive Whether the comparison is case-sensitive
@param  bool   $returnIndex     Whether to return the matched array's item instead

@return bool|int    Whether the input string was found in the array or the item's index if found
@SuppressWarnings(PHPMD.BooleanArgumentFlag)
Verifies if the input string is one of the values of the given array .