Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <fabien@symfony.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Symfony\Component\HttpKernel\Event;
13
 
14
use Symfony\Component\HttpFoundation\Response;
15
 
16
/**
17
 * Allows to create a response for a request.
18
 *
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
21
 * response is set.
22
 *
23
 * @author Bernhard Schussek <bschussek@gmail.com>
24
 */
25
class RequestEvent extends KernelEvent
26
{
27
    private ?Response $response = null;
28
 
29
    /**
30
     * Returns the response object.
31
     */
32
    public function getResponse(): ?Response
33
    {
34
        return $this->response;
35
    }
36
 
37
    /**
38
     * Sets a response and stops event propagation.
39
     */
40
    public function setResponse(Response $response)
41
    {
42
        $this->response = $response;
43
 
44
        $this->stopPropagation();
45
    }
46
 
47
    /**
48
     * Returns whether a response was set.
49
     */
50
    public function hasResponse(): bool
51
    {
52
        return null !== $this->response;
53
    }
54
}