Passed
Push — master ( 8fb003...dae8ba )
by Divine Niiquaye
11:39
created

CallbackHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Flight Routing.
7
 *
8
 * PHP version 7.1 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2019 Biurad Group (https://biurad.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Flight\Routing\Handlers;
19
20
use Psr\Http\Message\ResponseInterface;
21
use Psr\Http\Message\ServerRequestInterface;
22
use Psr\Http\Server\RequestHandlerInterface;
23
24
final class CallbackHandler implements RequestHandlerInterface
25
{
26
    /** @var callable */
27
    private $callback;
28
29
    public function __construct(callable $callback)
30
    {
31
        $this->callback = $callback;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function handle(ServerRequestInterface $request): ResponseInterface
38
    {
39
        return ($this->callback)($request);
40
    }
41
}
42