4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpKernel\Event;
14 use Symfony\Component\EventDispatcher\Event;
15 use Symfony\Component\HttpFoundation\Request;
16 use Symfony\Component\HttpKernel\HttpKernelInterface;
19 * Base class for events thrown in the HttpKernel component.
21 * @author Bernhard Schussek <bschussek@gmail.com>
23 class KernelEvent extends Event
30 * @param HttpKernelInterface $kernel The kernel in which this event was thrown
31 * @param Request $request The request the kernel is currently processing
32 * @param int $requestType The request type the kernel is currently processing; one of
33 * HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST
35 public function __construct(HttpKernelInterface $kernel, Request $request, $requestType)
37 $this->kernel = $kernel;
38 $this->request = $request;
39 $this->requestType = $requestType;
43 * Returns the kernel in which this event was thrown.
45 * @return HttpKernelInterface
47 public function getKernel()
53 * Returns the request the kernel is currently processing.
57 public function getRequest()
59 return $this->request;
63 * Returns the request type the kernel is currently processing.
65 * @return int One of HttpKernelInterface::MASTER_REQUEST and
66 * HttpKernelInterface::SUB_REQUEST
68 public function getRequestType()
70 return $this->requestType;
74 * Checks if this is a master request.
76 * @return bool True if the request is a master request
78 public function isMasterRequest()
80 return HttpKernelInterface::MASTER_REQUEST === $this->requestType;