onlyPublic()->usersScopes(); } elseif ($grantType === 'client_credentials') { $query->machineScopes(); $isTrusted = false; if ($clientId !== null) { $client = $this->server->getClientStorage()->get($clientId); if (!$client instanceof ClientEntity) { throw new ErrorException('client storage must return instance of ' . ClientEntity::class); } $isTrusted = $client->isTrusted(); } if (!$isTrusted) { $query->onlyPublic(); } } $scopes = $query->all(); if (!in_array($scope, $scopes, true)) { return null; } $entity = new ScopeEntity($this->server); $entity->setId($scope); return $entity; } }