DMS\Filter\Filters\ToUpper::useEncoding PHP Method

useEncoding() public method

Verify is encoding is set and if we have the proper function to use it
public useEncoding ( ToUpper $rule ) : boolean
$rule DMS\Filter\Rules\ToUpper
return boolean
    public function useEncoding($rule)
    {
        if ($rule->encoding === null) {
            return false;
        }
        if (!function_exists('mb_strtoupper')) {
            throw new FilterException('mbstring is required to use ToLower with an encoding.');
        }
        $this->encoding = (string) $rule->encoding;
        $encodings = array_map('strtolower', mb_list_encodings());
        if (!in_array(strtolower($rule->encoding), $encodings)) {
            throw new FilterException("mbstring does not support the '" . $rule->encoding . "' encoding");
        }
        return true;
    }