/** * {@inheritdoc} */ public function getScopes(AccessTokenEntity $token) { $key = RedisUtil::prefix($token->getId(), 'oauth_access_token_scopes'); if (isset($this->cache[$key])) { $result = $this->cache[$key]; } else { $result = $this->cache[$key] = RedisUtil::map(RedisCapsule::smembers($key)); } $response = []; foreach ($result as $row) { $key = RedisUtil::prefix($row['id'], 'oauth_scopes'); if (isset($this->cache[$key])) { $scope = $this->cache[$key]; } else { if (!($value = RedisCapsule::get($key))) { continue; } $scope = $this->cache[$key] = RedisUtil::unserialize($value); } $response[] = (new ScopeEntity($this->server))->hydrate(['id' => $scope['id'], 'description' => $scope['description']]); } return $response; }