<?php
namespace Harmonizely\EventListener;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
class ReferrerListener
{
public function onKernelResponse(ResponseEvent $event): void
{
if ($event->getRequest()->get('ref')) {
$event->getResponse()->headers->setCookie(
new Cookie(
'ref', $event->getRequest()->get('ref'), time() + 60 * 60 * 24 * 14, '/'
)
);
}
}
}