<?php /** * This file is a part of SymfonySecurity package. * * (c) Nekland <dev@nekland.fr> * * For the full license, take a look to the LICENSE file * on the root directory of this project */ namespace BiiG\SecurityTest; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Event\FinishRequestEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; class Kernel implements HttpKernelInterface { private $dispatcher; private $run; public function __construct(EventDispatcher $dispatcher, \Closure $run) { $this->dispatcher = $dispatcher; $this->run = $run; } public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) { $this->dispatcher->dispatch(KernelEvents::REQUEST, new GetResponseEvent($this, $request, $type)); // Some work $run = $this->run; $response = $run(); $this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this, $request, $type)); return $response; } }