public function onResponse(ResponseEvent $event)
 {
     $response = $event->getResponse();
     $headers = $response->headers;
     if (!$headers->has('Content-Length') && !$headers->has('Transfer-Encoding')) {
         $headers->set('Content-Length', strlen($response->getContent()));
     }
 }
 public function onResponse(ResponseEvent $event)
 {
     $response = $event->getResponse();
     if ($response->isRedirection() || $response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html') || 'html' !== $event->getRequest()->getRequestFormat()) {
         return;
     }
     $response->setContent($response->getContent() . 'GA CODE');
 }
 public function onPostController(ResponseEvent $event)
 {
     $session = $event->getSession();
     if ($session->has('gameFinished')) {
         $session->clear();
         return;
     }
     $fleet = $this->battlefield->getFleet();
     $shots = $this->shotsManager->getAllShots();
     $hits = $this->shotsManager->getHits();
     $session->set('fleet', serialize($fleet));
     $session->set('shots', serialize($shots));
     $session->set('hits', serialize($hits));
 }