isEnabled) { return new RedirectResponse('/'); } $code = $request->getAttribute('code'); try { $cmd = new TrackAffiliateCommand($code, 'click'); $this->dispatcher->dispatch($cmd); } catch (Throwable $th) { //throw $th; } $resp = new RedirectResponse('/'); $cookie = new ReferralCookie($code); return $resp ->withHeader('Set-Cookie', $cookie->toHeaderValue()); } }