functions = $functions; } #[Route('/{day}/{month}/{year}', name: 'home')] public function home(int $day, int $month, int $year): Response { $dateAsString = $year . "-" . $month . "-" . $day; try { $result = $this->functions->howDaysToNy(new DateTimeImmutable($dateAsString)); } catch (\Exception $e) { return new Response($e->getMessage()); } return $this->json(["Days before NY:" => $result]); } }