<?php
namespace App\EventListener;
use App\Service\Customer\TrackerActivityService;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
class TrackerActivityListener
{
/** @var TrackerActivityService */
protected $trackerActivityService;
public function __construct(TrackerActivityService $trackerActivityService)
{
$this->trackerActivityService = $trackerActivityService;
}
public function onKernelResponse(ResponseEvent $event)
{
if ($this->trackerActivityService->isTrackerActivityInProgress()) {
$trackerActivity = $this->trackerActivityService->getTrackerActivity();
if ($this->trackerActivityService::isTrackerActivityAtTimeLimit($trackerActivity)) {
$this->trackerActivityService->setTrackerActivityAsAbandoned($trackerActivity);
}
}
}
}