Passed
Push — master ( b6a195...1e79f7 )
by mcfog
03:21
created

FixedResponseHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A wrap() 0 3 1
A __construct() 0 3 1
A main() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lit\Nimo\Handlers;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
class FixedResponseHandler extends AbstractHandler
11
{
12
    protected $fixedResponse;
13
14
    /**
15
     * @param ResponseInterface $response always return this response
16
     */
17 1
    public function __construct(ResponseInterface $response)
18
    {
19 1
        $this->fixedResponse = $response;
20 1
    }
21
22 1
    public static function wrap(ResponseInterface $response): RequestHandlerInterface
23
    {
24 1
        return new static($response);
25
    }
26
27 1
    protected function main(): ResponseInterface
28
    {
29 1
        return $this->fixedResponse;
30
    }
31
}
32