Completed
Push — master ( be05e4...11542d )
by Taosikai
13:50
created

Delegate   A

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