public function get($scope, $grantType = null, $clientId = null)
    {
        $query = $this->getConnection()->table('oauth_scopes')
                    ->select('oauth_scopes.id as id', 'oauth_scopes.description as description')
                    ->where('oauth_scopes.id', $scope);

        if ($this->limitClientsToScopes === true && !is_null($clientId)) {
            $query = $query->join('oauth_client_scopes', 'oauth_scopes.id', '=', 'oauth_client_scopes.scope_id')
                           ->where('oauth_client_scopes.client_id', $clientId);
        }

        if ($this->limitScopesToGrants === true && !is_null($grantType)) {
            $query = $query->join('oauth_grant_scopes', 'oauth_scopes.id', '=', 'oauth_grant_scopes.scope_id')
                           ->join('oauth_grants', 'oauth_grants.id', '=', 'oauth_grant_scopes.grant_id')
                           ->where('oauth_grants.id', $grantType);
        }

        $result = $query->first();

        if (is_null($result)) {
            return;
        }

        $scope = new ScopeEntity($this->getServer());
        $scope->hydrate([
            'id' => $result->id,
            'description' => $result->description,
        ]);

        return $scope;
    }
public function get($scope, $grantType = null, $clientId = null)
    {
        $query = $this->getConnection()->table('oauth_scopes')
                    ->select('oauth_scopes.id as id', 'oauth_scopes.description as description')
                    ->where('oauth_scopes.id', $scope);

        if ($this->limitClientsToScopes === true && !is_null($clientId)) {
            $query = $query->join('oauth_client_scopes', 'oauth_scopes.id', '=', 'oauth_client_scopes.scope_id')
                           ->where('oauth_client_scopes.client_id', $clientId);
        }

        if ($this->limitScopesToGrants === true && !is_null($grantType)) {
            $query = $query->join('oauth_grant_scopes', 'oauth_scopes.id', '=', 'oauth_grant_scopes.scope_id')
                           ->join('oauth_grants', 'oauth_grants.id', '=', 'oauth_grant_scopes.grant_id')
                           ->where('oauth_grants.id', $grantType);
        }

        $result = $query->first();

        if (is_null($result)) {
            return;
        }

        $scope = new ScopeEntity($this->getServer());
        $scope->hydrate([
            'id' => $result->id,
            'description' => $result->description,
        ]);

        return $scope;
    }
public function get ( $ scope , $ grantType = null , $ clientId = null ) { $ query = $ this -> getConnection ( ) -> table ( 'oauth_scopes' ) -> select ( 'oauth_scopes.id as id' , 'oauth_scopes.description as description' ) -> where ( 'oauth_scopes.id' , $ scope ) ; if ( $ this -> limitClientsToScopes === true && ! is_null ( $ clientId ) ) { $ query = $ query -> join ( 'oauth_client_scopes' , 'oauth_scopes.id' , '=' , 'oauth_client_scopes.scope_id' ) -> where ( 'oauth_client_scopes.client_id' , $ clientId ) ; } if ( $ this -> limitScopesToGrants === true && ! is_null ( $ grantType ) ) { $ query = $ query -> join ( 'oauth_grant_scopes' , 'oauth_scopes.id' , '=' , 'oauth_grant_scopes.scope_id' ) -> join ( 'oauth_grants' , 'oauth_grants.id' , '=' , 'oauth_grant_scopes.grant_id' ) -> where ( 'oauth_grants.id' , $ grantType ) ; } $ result = $ query -> first ( ) ; if ( is_null ( $ result ) ) { return ; } $ scope = new ScopeEntity ( $ this -> getServer ( ) ) ; $ scope -> hydrate ( [ 'id' => $ result -> id , 'description' => $ result -> description , ] ) ; return $ scope ; }
Return information about a scope.

Example SQL query:

<code>
SELECT * FROM oauth_scopes WHERE scope = :scope
</code>

@param string $scope The scope
@param string $grantType The grant type used in the request (default = "null")
@param string $clientId The client id used for the request (default = "null")

@return \League\OAuth2\Server\Entity\ScopeEntity|null If the scope doesn't exist return false
Return information about a scope .