|
0
|
1 |
<?php |
|
|
2 |
|
|
|
3 |
/* |
|
|
4 |
* This file is part of the Symfony package. |
|
|
5 |
* |
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com> |
|
|
7 |
* |
|
|
8 |
* For the full copyright and license information, please view the LICENSE |
|
|
9 |
* file that was distributed with this source code. |
|
|
10 |
*/ |
|
|
11 |
|
|
|
12 |
namespace Symfony\Component\HttpKernel\Event; |
|
|
13 |
|
|
|
14 |
use Symfony\Component\HttpKernel\HttpKernelInterface; |
|
|
15 |
use Symfony\Component\HttpFoundation\Request; |
|
|
16 |
use Symfony\Component\EventDispatcher\Event; |
|
|
17 |
|
|
|
18 |
/** |
|
|
19 |
* Base class for events thrown in the HttpKernel component |
|
|
20 |
* |
|
|
21 |
* @author Bernhard Schussek <bernhard.schussek@symfony.com> |
|
|
22 |
* |
|
|
23 |
* @api |
|
|
24 |
*/ |
|
|
25 |
class KernelEvent extends Event |
|
|
26 |
{ |
|
|
27 |
/** |
|
|
28 |
* The kernel in which this event was thrown |
|
|
29 |
* @var Symfony\Component\HttpKernel\HttpKernelInterface |
|
|
30 |
*/ |
|
|
31 |
private $kernel; |
|
|
32 |
|
|
|
33 |
/** |
|
|
34 |
* The request the kernel is currently processing |
|
|
35 |
* @var Symfony\Component\HttpFoundation\Request |
|
|
36 |
*/ |
|
|
37 |
private $request; |
|
|
38 |
|
|
|
39 |
/** |
|
|
40 |
* The request type the kernel is currently processing. One of |
|
|
41 |
* HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST |
|
|
42 |
* @var integer |
|
|
43 |
*/ |
|
|
44 |
private $requestType; |
|
|
45 |
|
|
|
46 |
public function __construct(HttpKernelInterface $kernel, Request $request, $requestType) |
|
|
47 |
{ |
|
|
48 |
$this->kernel = $kernel; |
|
|
49 |
$this->request = $request; |
|
|
50 |
$this->requestType = $requestType; |
|
|
51 |
} |
|
|
52 |
|
|
|
53 |
/** |
|
|
54 |
* Returns the kernel in which this event was thrown |
|
|
55 |
* |
|
|
56 |
* @return Symfony\Component\HttpKernel\HttpKernelInterface |
|
|
57 |
* |
|
|
58 |
* @api |
|
|
59 |
*/ |
|
|
60 |
public function getKernel() |
|
|
61 |
{ |
|
|
62 |
return $this->kernel; |
|
|
63 |
} |
|
|
64 |
|
|
|
65 |
/** |
|
|
66 |
* Returns the request the kernel is currently processing |
|
|
67 |
* |
|
|
68 |
* @return Symfony\Component\HttpFoundation\Request |
|
|
69 |
* |
|
|
70 |
* @api |
|
|
71 |
*/ |
|
|
72 |
public function getRequest() |
|
|
73 |
{ |
|
|
74 |
return $this->request; |
|
|
75 |
} |
|
|
76 |
|
|
|
77 |
/** |
|
|
78 |
* Returns the request type the kernel is currently processing |
|
|
79 |
* |
|
|
80 |
* @return integer One of HttpKernelInterface::MASTER_REQUEST and |
|
|
81 |
* HttpKernelInterface::SUB_REQUEST |
|
|
82 |
* |
|
|
83 |
* @api |
|
|
84 |
*/ |
|
|
85 |
public function getRequestType() |
|
|
86 |
{ |
|
|
87 |
return $this->requestType; |
|
|
88 |
} |
|
|
89 |
} |