public function scopeExists($scope, $client_id = null)
    {
        $scopes = explode(' ', $scope);
        if ($client_id) {
            // Get Client
            $client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);

            if (!$client) {
                return false;
            }

            $valid_scopes = $client->getScopes();

            foreach ($scopes as $scope) {
                if (!in_array($scope, $valid_scopes)) {
                    return false;
                }
            }

            return true;
        }

        $valid_scopes = $this->sm->findScopesByScopes($scopes);

        return count($valid_scopes) == count($scopes);
    }
public function scopeExists($scope, $client_id = null)
    {
        $scopes = explode(' ', $scope);
        if ($client_id) {
            // Get Client
            $client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);

            if (!$client) {
                return false;
            }

            $valid_scopes = $client->getScopes();

            foreach ($scopes as $scope) {
                if (!in_array($scope, $valid_scopes)) {
                    return false;
                }
            }

            return true;
        }

        $valid_scopes = $this->sm->findScopesByScopes($scopes);

        return count($valid_scopes) == count($scopes);
    }
public function scopeExists ( $ scope , $ client_id = null ) { $ scopes = explode ( ' ' , $ scope ) ; if ( $ client_id ) { // Get Client $ client = $ this -> em -> getRepository ( 'OAuth2ServerBundle:Client' ) -> find ( $ client_id ) ; if ( ! $ client ) { return false ; } $ valid_scopes = $ client -> getScopes ( ) ; foreach ( $ scopes as $ scope ) { if ( ! in_array ( $ scope , $ valid_scopes ) ) { return false ; } } return true ; } $ valid_scopes = $ this -> sm -> findScopesByScopes ( $ scopes ) ; return count ( $ valid_scopes ) == count ( $ scopes ) ; }
Check if the provided scope exists.

@param $scope
A space-separated string of scopes.
@param $client_id
The requesting client.

@return
TRUE if it exists, FALSE otherwise.
Check if the provided scope exists .