RESTfulAPI::api_access_config_check PHP Method

api_access_config_check() private static method

api_access config can be: - unset|false, access is always denied - true, access is always granted - comma separated list of allowed HTTP methods
private static api_access_config_check ( string $className, string $httpMethod = 'GET' ) : boolean
$className string Model's classname
$httpMethod string API request HTTP method
return boolean true if access is granted, false otherwise
    private static function api_access_config_check($className, $httpMethod = 'GET')
    {
        $access = false;
        $api_access = singleton($className)->stat('api_access');
        if (is_string($api_access)) {
            $api_access = explode(',', strtoupper($api_access));
            if (in_array($httpMethod, $api_access)) {
                $access = true;
            } else {
                $access = false;
            }
        } elseif ($api_access === true) {
            $access = true;
        }
        return $access;
    }