| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
||
| 43 | { |
||
| 44 | $stack = new Stack(); |
||
| 45 | $stack->setClient($this->client); |
||
| 46 | $stack->setRequest($this->formatter->formatRequest($request)); |
||
| 47 | |||
| 48 | $this->collector->addStack($stack); |
||
| 49 | return $next($request)->then(function (ResponseInterface $response) use ($stack) { |
||
| 50 | $stack->setResponse($this->formatter->formatResponse($response)); |
||
| 51 | |||
| 52 | return $response; |
||
| 53 | }, function (Exception $exception) use ($stack) { |
||
| 54 | $stack->setResponse($this->formatter->formatException($exception)); |
||
| 55 | $stack->setFailed(true); |
||
| 56 | |||
| 57 | throw $exception; |
||
| 58 | }); |
||
| 59 | } |
||
| 60 | } |
||
| 61 |