Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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;
$this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this, $request, $type));