OAuth2\OAuth2::checkScope PHP Method

checkScope() protected method

Check if everything in required scope is contained in available scope.
See also: http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-7
protected checkScope ( string $requiredScope, string $availableScope ) : boolean
$requiredScope string Required scope to be check with.
$availableScope string Supported scopes.
return boolean Return true if everything in required scope is contained in available scope or false if it isn't.
    protected function checkScope($requiredScope, $availableScope)
    {
        // The required scope should match or be a subset of the available scope
        if (!is_array($requiredScope)) {
            $requiredScope = explode(' ', trim($requiredScope));
        }
        if (!is_array($availableScope)) {
            $availableScope = explode(' ', trim($availableScope));
        }
        return count(array_diff($requiredScope, $availableScope)) == 0;
    }