podcastDataReader->getCachedOrFetchPodcastData($url, $this->userService->getUserUID()); if ($podcasts) { return new JSONResponse(['data' => $podcasts]); } $client = $this->clientService->newClient(); $feed = $client->get($url); $statusCode = $feed->getStatusCode(); if ($statusCode < 200 || $statusCode >= 300) { throw new \ErrorException("Web request returned non-2xx status code: {$statusCode}"); } $podcasts = PodcastData::parseRssXml((string) $feed->getBody()); return new JSONResponse(['data' => $podcasts], $statusCode); } }