FilterResponseEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getResponse() 0 4 1
A setResponse() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the jade/jade package.
5
 *
6
 * (c) Slince <[email protected]>
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 Jade\HttpKernel\Event;
13
14
use Psr\Http\Message\ResponseInterface;
15
use Psr\Http\Message\ServerRequestInterface;
16
use Jade\HttpKernel\HttpKernel;
17
18
/**
19
 * 允许动态修改内核周期结束之后产生的response
20
 */
21
class FilterResponseEvent extends KernelEvent
22
{
23
    protected $response;
24
25
    public function __construct(HttpKernel $kernel, ServerRequestInterface $request, ResponseInterface $response)
26
    {
27
        parent::__construct($kernel, $request);
28
        $this->response = $response;
29
    }
30
31
    /**
32
     * 返回当前处理得到的response
33
     *
34
     * @return ResponseInterface
35
     */
36
    public function getResponse()
37
    {
38
        return $this->response;
39
    }
40
41
    /**
42
     * 设置一个新的response对象来替换
43
     *
44
     * @param ResponseInterface $response
45
     */
46
    public function setResponse(ResponseInterface $response)
47
    {
48
        $this->response = $response;
49
    }
50
}