podcastDataReader->tryGetCachedPodcastData($url); if ($podcast) { return new JSONResponse(['data' => $podcast]); } $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}"); } $podcast = PodcastData::parseRssXml((string) $feed->getBody()); $this->podcastDataReader->trySetCachedPodcastData($url, $podcast); return new JSONResponse(['data' => $podcast], $statusCode); } }