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

CallableHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 4 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