1 | <?php |
||
17 | class Dispatcher implements LegacyMiddlewareInterface, RequestHandlerInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var callable middleware resolver |
||
21 | */ |
||
22 | private $resolver; |
||
23 | |||
24 | /** |
||
25 | * @var mixed[] unresolved middleware stack |
||
26 | */ |
||
27 | private $stack; |
||
28 | |||
29 | /** |
||
30 | * @param (callable|MiddlewareInterface|mixed)[] $stack middleware stack (with at least one middleware component) |
||
31 | * @param callable|null $resolver optional middleware resolver: |
||
32 | * function (string $name): MiddlewareInterface |
||
33 | * |
||
34 | * @throws InvalidArgumentException if an empty middleware stack was given |
||
35 | */ |
||
36 | 1 | public function __construct($stack, callable $resolver = null) |
|
45 | |||
46 | /** |
||
47 | * Dispatches the middleware stack and returns the resulting `ResponseInterface`. |
||
48 | * |
||
49 | * @param ServerRequestInterface $request |
||
50 | * |
||
51 | * @return ResponseInterface |
||
52 | * |
||
53 | * @throws LogicException on unexpected result from any middleware on the stack |
||
54 | */ |
||
55 | 1 | public function handle(ServerRequestInterface $request): ResponseInterface |
|
61 | |||
62 | /** |
||
63 | * Dispatches the middleware stack and returns the resulting `ResponseInterface`. |
||
64 | * |
||
65 | * @deprecated in favor of identical PSR-15 method `RequestHandlerInterface::handle()` |
||
66 | * |
||
67 | * @param ServerRequestInterface $request |
||
68 | * |
||
69 | * @return ResponseInterface |
||
70 | * |
||
71 | * @throws LogicException on unexpected result from any middleware on the stack |
||
72 | */ |
||
73 | 1 | public function dispatch(ServerRequestInterface $request): ResponseInterface |
|
77 | |||
78 | /** |
||
79 | * @inheritdoc |
||
80 | */ |
||
81 | 1 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
93 | |||
94 | /** |
||
95 | * @param int $index middleware stack index |
||
96 | * |
||
97 | * @return RequestHandlerInterface |
||
98 | */ |
||
99 | 1 | private function resolve($index): RequestHandlerInterface |
|
138 | } |
||
139 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.