<?php
namespace App\Package\Openform\EventSubscriber;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class ChangerListener
{
/**
* Ten event wylapie nieobsluzony changeLang w controlerze
*
* @param ResponseEvent $event
* @return void
*/
public function onKernelResponse(ResponseEvent $event)
{
$response = $event->getResponse();
if (!$response instanceof RedirectResponse) {
$request = $event->getRequest();
if (strpos($request->get('_route'), 'changer_') === 0) {
throw new NotFoundHttpException('Not found. Try to define onChangeLocale in ' . $request->get('_controller') . '');
}
}
}
}