Completed
Push — master ( 493bbf...db23dc )
by Dmitry
13:54
created

CallableHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace hiapi\middlewares;
5
6
use League\Tactician\Middleware;
7
8
/**
9
 * Class CallableHandler
10
 *
11
 * @author Dmytro Naumenko <[email protected]>
12
 */
13
class CallableHandler implements Middleware
14
{
15
    /**
16
     * @var callable
17
     */
18
    private $callable;
19
20
    public function __construct(callable $callable)
21
    {
22
        $this->callable = $callable;
23
    }
24
25
    /**
26
     * @param object $command
27
     * @param callable $next
28
     *
29
     * @return mixed
30
     */
31
    public function execute($command, callable $next)
32
    {
33
        return call_user_func($this->callable, $command);
34
    }
35
}
36