ResponseEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 18
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setResponse() 0 3 1
A __construct() 0 4 1
A getResponse() 0 3 1
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of Biurad opensource projects.
5
 *
6
 * @copyright 2019 Biurad Group (https://biurad.com/)
7
 * @license   https://opensource.org/licenses/BSD-3-Clause License
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Flange\Event;
14
15
use Flange\Application;
16
use Psr\Http\Message\ResponseInterface as Response;
17
use Psr\Http\Message\ServerRequestInterface as Request;
18
19
/**
20
 * Allows to filter a Response object.
21
 *
22
 * You can call getResponse() to retrieve the current response. With
23
 * setResponse() you can set a new response that will be returned to the
24
 * browser.
25
 *
26
 * @author Divine Niiquaye Ibok <[email protected]>
27
 */
28
final class ResponseEvent extends KernelEvent
29
{
30
    private Response $response;
31
32
    public function __construct(Application $app, Request $request, Response $response)
33
    {
34
        parent::__construct($app, $request);
35
        $this->setResponse($response);
36
    }
37
38
    public function getResponse(): Response
39
    {
40
        return $this->response;
41
    }
42
43
    public function setResponse(Response $response): void
44
    {
45
        $this->response = $response;
46
    }
47
}
48