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
28 * The response object.
35 * Returns the response object.
39 public function getResponse()
41 return $this->response;
45 * Sets a response and stops event propagation.
47 * @param Response $response
49 public function setResponse(Response $response)
51 $this->response = $response;
53 $this->stopPropagation();
57 * Returns whether a response was set.
59 * @return bool Whether a response was set
61 public function hasResponse()
63 return null !== $this->response;