Created
July 22, 2014 09:21
-
-
Save nomasprime/b4a6d6ebfcef5a4cd39e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AnalogFolk\GatewayBundle\EventListener; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
use Symfony\Component\HttpFoundation\RedirectResponse; | |
use AnalogFolk\GatewayBundle\Security\Gateway\Geo; | |
use AnalogFolk\GatewayBundle\Controller\GatedController; | |
use AnalogFolk\GatewayBundle\Controller\MainController; | |
class GatewayListener | |
{ | |
public function onKernelRequest(GetResponseEvent $event) | |
{ | |
if ($event->isMasterRequest() === false || $event->getRequest()->getRequestFormat() !== 'html') { | |
return; | |
} | |
if ($event->getRequest()->attributes->get('_route') === 'analog_folk_gateway') return; | |
$response = new RedirectResponse('/gateway'); | |
$event->setResponse($response); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment