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\HttpFoundation\Response;
17 * Allows to create a response for a request.
19 * Call setResponse() to set the response that will be returned for the
20 * current request. The propagation of this event is stopped as soon as a
23 * @author Bernhard Schussek <bschussek@gmail.com>
25 class GetResponseEvent extends KernelEvent
30 * Returns the response object.
32 * @return Response|null
34 public function getResponse()
36 return $this->response;
40 * Sets a response and stops event propagation.
42 public function setResponse(Response $response)
44 $this->response = $response;
46 $this->stopPropagation();
50 * Returns whether a response was set.
52 * @return bool Whether a response was set
54 public function hasResponse()
56 return null !== $this->response;