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\HttpKernel\HttpKernelInterface;
15 use Symfony\Component\HttpFoundation\Request;
16 use Symfony\Component\EventDispatcher\Event;
19 * Base class for events thrown in the HttpKernel component.
21 * @author Bernhard Schussek <bschussek@gmail.com>
23 class KernelEvent extends Event
26 * The kernel in which this event was thrown.
28 * @var HttpKernelInterface
33 * The request the kernel is currently processing.
40 * The request type the kernel is currently processing. One of
41 * HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST.
47 public function __construct(HttpKernelInterface $kernel, Request $request, $requestType)
49 $this->kernel = $kernel;
50 $this->request = $request;
51 $this->requestType = $requestType;
55 * Returns the kernel in which this event was thrown.
57 * @return HttpKernelInterface
59 public function getKernel()
65 * Returns the request the kernel is currently processing.
69 public function getRequest()
71 return $this->request;
75 * Returns the request type the kernel is currently processing.
77 * @return int One of HttpKernelInterface::MASTER_REQUEST and
78 * HttpKernelInterface::SUB_REQUEST
80 public function getRequestType()
82 return $this->requestType;
86 * Checks if this is a master request.
88 * @return bool True if the request is a master request
90 public function isMasterRequest()
92 return HttpKernelInterface::MASTER_REQUEST === $this->requestType;