podcastMetricsReader->metrics($this->userService->getUserUID()); usort($metrics, fn (PodcastMetrics $a, PodcastMetrics $b) => $b->getListenedSeconds() <=> $a->getListenedSeconds()); $subscriptions = []; foreach ($metrics as $metric) { $subscription = $metric->toArray(); try { $subscription['data'] = $this->podcastDataReader->getCachedOrFetchPodcastData($metric->getUrl(), $this->userService->getUserUID()); } catch (\Exception $e) { } $subscriptions[] = $subscription; } return new JSONResponse($subscriptions); } }