Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
19 | protected function push(callable $newTopMiddleware) |
||
20 | { |
||
21 | $oldStack = $this->middlewareStack; |
||
22 | |||
23 | if ($oldStack === null) { |
||
24 | $this->middlewareStack = $newTopMiddleware; |
||
25 | |||
26 | return $this; |
||
27 | } |
||
28 | |||
29 | $this->middlewareStack = function ($request, $response, callable $next) use ($oldStack, $newTopMiddleware) { |
||
30 | return $newTopMiddleware($request, $response, function ($req, $res) use ($next, $oldStack) { |
||
31 | return $oldStack($req, $res, $next); |
||
32 | }); |
||
33 | }; |
||
34 | |||
35 | return $this; |
||
36 | } |
||
37 | } |
||
38 |