for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of DivineNii opensource projects.
*
* PHP version 7.4 and above required
* @author Divine Niiquaye Ibok <[email protected]>
* @copyright 2019 DivineNii (https://divinenii.com/)
* @license https://opensource.org/licenses/BSD-3-Clause License
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Rade\Event;
use Psr\Http\Message\ResponseInterface;
/**
* Allows to create a response for a request.
* Call setResponse() to set the response that will be returned for the
* current request. The propagation of this event is stopped as soon as a
* response is set.
class RequestEvent extends KernelEvent
{
private ?ResponseInterface $response = null;
* Returns the response object.
public function getResponse(): ?ResponseInterface
return $this->response;
}
* Sets a response and stops event propagation.
public function setResponse(ResponseInterface $response): void
$this->response = $response;
$this->stopPropagation();
* Returns whether a response was set.
* @return bool Whether a response was set
public function hasResponse(): bool
return null !== $this->response;