clientService->newClient(); $feed = $client->get($url); $episodes = $this->episodeActionReader->parseRssXml((string) $feed->getBody()); usort($episodes, fn (EpisodeActionExtraData $a, EpisodeActionExtraData $b) => $b->getPubDate() <=> $a->getPubDate()); $episodes = array_values(array_intersect_key($episodes, array_unique(array_map(fn (EpisodeActionExtraData $episode) => $episode->getGuid(), $episodes)))); return new JSONResponse($episodes, $feed->getStatusCode()); } 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); } }