| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function __invoke(callable $handler) |
||
| 19 | { |
||
| 20 | return function(RequestInterface $request, array $options) use ($handler) { |
||
| 21 | return $handler($request, $options)->then(function($response) use ($request, $options) { |
||
| 22 | $this->container->mergeInfo($request, [ |
||
| 23 | 'response' => $response, |
||
| 24 | 'error' => null, |
||
| 25 | 'options' => $options, |
||
| 26 | 'info' => [], |
||
| 27 | ]); |
||
| 28 | |||
| 29 | return $response; |
||
| 30 | }, function($reason) use ($request, $options) { |
||
| 31 | $this->container->mergeInfo($request, [ |
||
| 32 | 'response' => null, |
||
| 33 | 'error' => $reason, |
||
| 34 | 'options' => $options, |
||
| 35 | 'info' => [], |
||
| 36 | ]); |
||
| 37 | |||
| 38 | return new RejectedPromise($reason); |
||
| 39 | }); |
||
| 43 |