service = $service; $this->userId = $userId; } /** * @NoAdminRequired * * @param string $term * * @return JSONResponse */ #[TrapError] public function index(string $term): JSONResponse { if ($this->userId === null) { return new JSONResponse([]); } return (new JSONResponse($this->service->findMatches($this->userId, $term))) ->cacheFor(5 * 60, false, true); } }