Jetpack_Options::is_valid PHP Method

is_valid() public static method

Is the option name valid?
public static is_valid ( string $name, string | null $group = null ) : boolean
$name string The name of the option
$group string | null The name of the group that the option is in. Default to null, which will search non_compact.
return boolean Is the option name valid?
    public static function is_valid($name, $group = null)
    {
        if (is_array($name)) {
            $compact_names = array();
            foreach (array_keys(self::$grouped_options) as $_group) {
                $compact_names = array_merge($compact_names, self::get_option_names($_group));
            }
            $result = array_diff($name, self::get_option_names('non_compact'), $compact_names);
            return empty($result);
        }
        if (is_null($group) || 'non_compact' === $group) {
            if (in_array($name, self::get_option_names($group))) {
                return true;
            }
        }
        foreach (array_keys(self::$grouped_options) as $_group) {
            if (is_null($group) || $group === $_group) {
                if (in_array($name, self::get_option_names($_group))) {
                    return true;
                }
            }
        }
        return false;
    }