NextHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the slince/middleware package.
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Slince\Middleware;
13
14
use Interop\Http\Server\RequestHandlerInterface;
15
use Psr\Http\Message\ResponseInterface;
16
use Psr\Http\Message\ServerRequestInterface;
17
18
class NextHandler implements RequestHandlerInterface
19
{
20
    /**
21
     * @var callable
22
     */
23
    protected $callback;
24
25
    public function __construct(callable $callback)
26
    {
27
        $this->callback = $callback;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function handle(ServerRequestInterface $request): ResponseInterface
34
    {
35
        return call_user_func($this->callback, $request);
36
    }
37
}
38