clientService->newClient(); $feed = $client->get($url); $episodes = $this->episodeActionReader->parseRssXml((string) $feed->getBody()); usort($episodes, fn (EpisodeActionExtraData $a, EpisodeActionExtraData $b): int => $b->getPubDate() <=> $a->getPubDate()); $episodes = array_values(array_intersect_key($episodes, array_unique(array_map(fn (EpisodeActionExtraData $episode): string => $episode->getGuid(), $episodes)))); /** @var Http::STATUS_* $returnStatusCode */ $returnStatusCode = $feed->getStatusCode(); return new JSONResponse($episodes, $returnStatusCode); } #[NoAdminRequired] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/episodes/action')] public function action(string $url): JSONResponse { $action = $this->episodeActionRepository->findByEpisodeUrl($url, $this->userService->getUserUID()); if ($action) { return new JSONResponse($action->toArray()); } return new JSONResponse([], Http::STATUS_NOT_FOUND); } }