*/ #[NoAdminRequired] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/podcast')] public function index(string $url): Response { $podcast = null; if ($this->cacheFactory->isLocalCacheAvailable()) { try { $podcast = $this->podcastDataReader->tryGetCachedPodcastData($url); } catch (\Exception) { } } if ($podcast) { return new JSONResponse($podcast); } $client = $this->clientService->newClient(); $feed = $client->get($url); $podcast = PodcastData::parseRssXml((string) $feed->getBody()); if ($this->cacheFactory->isLocalCacheAvailable()) { try { $this->podcastDataReader->trySetCachedPodcastData($url, $podcast); } catch (\Exception) { } } /** @var Http::STATUS_* $returnStatusCode */ $returnStatusCode = $feed->getStatusCode(); /** @phpstan-ignore-next-line */ return new JSONResponse($podcast, $returnStatusCode); } }