Passed
Push — master ( 9b8457...f05bc0 )
by Alexander
01:49
created

Chain::next()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace alkemann\h2l;
4
5
class Chain
6
{
7
    private $chain;
8
9
    public function __construct(array $chained_callable = [])
10
    {
11
        $this->chain = $chained_callable;
12
    }
13
14
    public function next(Request $request): ?Response
15
    {
16
        if (empty($this->chain)) {
17
            throw new exceptions\EmptyChainError;
18
        }
19
        $next = array_shift($this->chain);
20
        return $next($request, $this);
21
    }
22
}
23