1 | <?php namespace Nimo; |
||
13 | class MiddlewarePipe extends AbstractMiddleware |
||
14 | { |
||
15 | /** |
||
16 | * @var CallableHandler |
||
17 | */ |
||
18 | protected $nextHandler; |
||
19 | /** |
||
20 | * @var MiddlewareInterface[] |
||
21 | */ |
||
22 | protected $stack = []; |
||
23 | protected $index; |
||
24 | |||
25 | public function __construct() |
||
31 | |||
32 | |||
33 | /** |
||
34 | * append $middleware |
||
35 | * return $this |
||
36 | * note this method would modify $this |
||
37 | * |
||
38 | * @param mixed $middleware |
||
39 | * @return $this |
||
40 | */ |
||
41 | 1 | public function append($middleware): MiddlewarePipe |
|
46 | |||
47 | /** |
||
48 | * prepend $middleware |
||
49 | * return $this |
||
50 | * note this method would modify $this |
||
51 | * |
||
52 | * @param $middleware |
||
53 | * @return $this |
||
54 | */ |
||
55 | 1 | public function prepend($middleware): MiddlewarePipe |
|
60 | |||
61 | 3 | protected function main(): ResponseInterface |
|
67 | |||
68 | /** |
||
69 | * @param ServerRequestInterface $request |
||
70 | * @return ResponseInterface |
||
71 | */ |
||
72 | 3 | protected function loop(ServerRequestInterface $request): ResponseInterface |
|
80 | } |
||
81 |