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