Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Cairns\Radiate; |
||
36 | 2 | private function createChain($middleware) |
|
37 | { |
||
38 | $last = function () { |
||
39 | // nothing |
||
40 | 2 | }; |
|
41 | |||
42 | 2 | while ($link = array_pop($middleware)) { |
|
43 | 2 | if (! $link instanceof Middleware) { |
|
44 | 1 | throw new InvalidMiddlewareException('Shitballs!'); |
|
45 | } |
||
46 | |||
47 | 1 | $last = function ($event) use ($link, $last) { |
|
48 | 1 | return $link->execute($event, $last); |
|
49 | 1 | }; |
|
50 | 1 | } |
|
51 | |||
52 | 1 | return $last; |
|
53 | } |
||
54 | } |
||
55 |