Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\HttpKernel\Event; Chris@0: Chris@0: use Symfony\Component\HttpFoundation\Response; Chris@0: Chris@0: /** Chris@0: * Allows to create a response for a request. Chris@0: * Chris@0: * Call setResponse() to set the response that will be returned for the Chris@0: * current request. The propagation of this event is stopped as soon as a Chris@0: * response is set. Chris@0: * Chris@0: * @author Bernhard Schussek Chris@0: */ Chris@0: class GetResponseEvent extends KernelEvent Chris@0: { Chris@0: private $response; Chris@0: Chris@0: /** Chris@0: * Returns the response object. Chris@0: * Chris@17: * @return Response|null Chris@0: */ Chris@0: public function getResponse() Chris@0: { Chris@0: return $this->response; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets a response and stops event propagation. Chris@0: */ Chris@0: public function setResponse(Response $response) Chris@0: { Chris@0: $this->response = $response; Chris@0: Chris@0: $this->stopPropagation(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns whether a response was set. Chris@0: * Chris@0: * @return bool Whether a response was set Chris@0: */ Chris@0: public function hasResponse() Chris@0: { Chris@0: return null !== $this->response; Chris@0: } Chris@0: }