Completed
Push — master ( d3629a...99177e )
by Dusan
02:35
created

CallableMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 4 1
1
<?php
2
/**
3
 * This file is part of the http-middleware package.
4
 *
5
 * Copyright (c) Dusan Vejin
6
 *
7
 * For full copyright and license information, please refer to the LICENSE file,
8
 * located at the package root folder.
9
 */
10
11
declare(strict_types=1);
12
13
namespace WeCodeIn\Http\Server\Middleware;
14
15
use Interop\Http\Server\RequestHandlerInterface;
16
use Interop\Http\Server\MiddlewareInterface;
17
use Psr\Http\Message\ResponseInterface;
18
use Psr\Http\Message\ServerRequestInterface;
19
20
class CallableMiddleware implements MiddlewareInterface
21
{
22
    protected $callable;
23
24 1
    public function __construct(callable $callable)
25
    {
26 1
        $this->callable = $callable;
27 1
    }
28
29 1
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
30
    {
31 1
        return ($this->callable)($request, $handler);
32
    }
33
}
34