1 | <?php |
||
9 | class Delegate implements DelegateInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | private $middleware; |
||
15 | |||
16 | /** |
||
17 | * @var callable |
||
18 | */ |
||
19 | private $default; |
||
20 | |||
21 | /** |
||
22 | * @var integer |
||
23 | */ |
||
24 | private $index = 0; |
||
25 | |||
26 | /** |
||
27 | * @param array $middleware |
||
28 | * @param callable $default |
||
29 | */ |
||
30 | 2 | public function __construct(array $middleware, callable $default) |
|
35 | |||
36 | /** |
||
37 | * Process the request using the current middleware. |
||
38 | * |
||
39 | * @param RequestInterface $request |
||
40 | * |
||
41 | * @return ResponseInterface |
||
42 | */ |
||
43 | 2 | public function process(RequestInterface $request) |
|
51 | |||
52 | /** |
||
53 | * Get a delegate pointing to the next middleware. |
||
54 | * |
||
55 | * @return static |
||
56 | */ |
||
57 | 1 | private function nextDelegate() |
|
64 | } |
||
65 |