NoopMiddleware   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A main() 0 3 1
A instance() 0 7 2
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 does nothing is a still valid middleware and can be useful sometimes.
11
 */
12
final class NoopMiddleware extends AbstractMiddleware
13
{
14 1
    public static function instance()
15
    {
16 1
        static $instance;
17 1
        if (!isset($instance)) {
18 1
            $instance = new self();
19
        }
20 1
        return $instance;
21
    }
22
23 2
    protected function main(): ResponseInterface
24
    {
25 2
        return $this->delegate();
26
    }
27
}
28