Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
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 | |||
50 | return $next($request)->then(function (ResponseInterface $response) use ($stack) { |
||
51 | $stack->setResponse($this->formatter->formatResponse($response)); |
||
52 | |||
53 | return $response; |
||
54 | }, function (Exception $exception) use ($stack) { |
||
55 | $stack->setResponse($this->formatter->formatException($exception)); |
||
56 | $stack->setFailed(true); |
||
57 | |||
58 | throw $exception; |
||
59 | }); |
||
60 | } |
||
61 | } |
||
62 |