1 | <?php declare(strict_types=1); |
||
13 | final class Middleware implements MiddlewareInterface |
||
14 | { |
||
15 | /** |
||
16 | * Return the processed $request via a fulfilled promise. |
||
17 | * When implementing cache or other feature that returns a response, do it with a rejected promise. |
||
18 | * If neither is possible, e.g. on some kind of failure, resolve the unaltered request. |
||
19 | * |
||
20 | * @param RequestInterface $request |
||
21 | * @param string $transactionId |
||
22 | * @param array $options |
||
23 | * @return CancellablePromiseInterface |
||
24 | */ |
||
25 | 2 | public function pre( |
|
33 | |||
34 | /** |
||
35 | * Return the processed $response via a promise. |
||
36 | * |
||
37 | * @param ResponseInterface $response |
||
38 | * @param string $transactionId |
||
39 | * @param array $options |
||
40 | * @return CancellablePromiseInterface |
||
41 | */ |
||
42 | 1 | public function post( |
|
50 | |||
51 | /** |
||
52 | * Deal with possible errors that occurred during request/response events. |
||
53 | * |
||
54 | * @param Throwable $throwable |
||
55 | * @param string $transactionId |
||
56 | * @param array $options |
||
57 | * @return CancellablePromiseInterface |
||
58 | */ |
||
59 | 1 | public function error( |
|
67 | } |
||
68 |