Passed
Push — master ( a02115...b30a41 )
by Henri
01:21
created

Middleware::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Example\Middleware;
4
5
use Psr\Http\Message\ServerRequestInterface;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Server\MiddlewareInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
class Middleware implements MiddlewareInterface{
11
    protected static array $data = [];
12
13
    public function __get($key)
14
    {
15
        return (array_key_exists($key,self::$data)) ? self::$data[$key] : null;
16
    }
17
18
    public function __set($key,$value)
19
    {
20
        self::$data[$key] = $value;
21
    }
22
23
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
24
    {
25
        return $handler->handle($request);
26
    }
27
28
}