FixedResponseMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A main() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lit\Nimo\Middlewares;
6
7
use Psr\Http\Message\ResponseInterface;
8
9
/**
10
 * A middleware that never delegate and always return a fixed response.
11
 */
12
class FixedResponseMiddleware extends AbstractMiddleware
13
{
14
    protected $fixedResponse;
15
16
    /**
17
     * @param ResponseInterface $response The fixed response.
18
     */
19 1
    public function __construct(ResponseInterface $response)
20
    {
21 1
        $this->fixedResponse = $response;
22 1
    }
23
24 1
    protected function main(): ResponseInterface
25
    {
26 1
        return $this->fixedResponse;
27
    }
28
}
29