@@ 57-73 (lines=17) @@ | ||
54 | /** |
|
55 | * {@inheritdoc} |
|
56 | */ |
|
57 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
|
58 | { |
|
59 | $profile = new Profile($this->pluginName, $this->formatter->formatRequest($request)); |
|
60 | ||
61 | $this->collector->getCurrentStack()->addProfile($profile); |
|
62 | ||
63 | return $this->plugin->handleRequest($request, $next, $first)->then(function (ResponseInterface $response) use ($profile) { |
|
64 | $profile->setResponse($this->formatter->formatResponse($response)); |
|
65 | ||
66 | return $response; |
|
67 | }, function (Exception $exception) use ($profile) { |
|
68 | $profile->setFailed(true); |
|
69 | $profile->setResponse($this->formatter->formatException($exception)); |
|
70 | ||
71 | throw $exception; |
|
72 | }); |
|
73 | } |
|
74 | } |
|
75 |
@@ 50-66 (lines=17) @@ | ||
47 | /** |
|
48 | * {@inheritdoc} |
|
49 | */ |
|
50 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
|
51 | { |
|
52 | $stack = new Stack($this->client, $this->formatter->formatRequest($request)); |
|
53 | ||
54 | $this->collector->addStack($stack); |
|
55 | ||
56 | return $next($request)->then(function (ResponseInterface $response) use ($stack) { |
|
57 | $stack->setResponse($this->formatter->formatResponse($response)); |
|
58 | ||
59 | return $response; |
|
60 | }, function (Exception $exception) use ($stack) { |
|
61 | $stack->setResponse($this->formatter->formatException($exception)); |
|
62 | $stack->setFailed(true); |
|
63 | ||
64 | throw $exception; |
|
65 | }); |
|
66 | } |
|
67 | } |
|
68 |