Code Duplication    Length = 17-17 lines in 2 locations

Collector/ProfilePlugin.php 1 location

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

Collector/StackPlugin.php 1 location

@@ 47-63 (lines=17) @@
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function handleRequest(RequestInterface $request, callable $next, callable $first)
48
    {
49
        $stack = new Stack($this->client, $this->formatter->formatRequest($request));
50
51
        $this->collector->addStack($stack);
52
53
        return $next($request)->then(function (ResponseInterface $response) use ($stack) {
54
            $stack->setResponse($this->formatter->formatResponse($response));
55
56
            return $response;
57
        }, function (Exception $exception) use ($stack) {
58
            $stack->setResponse($this->formatter->formatException($exception));
59
            $stack->setFailed(true);
60
61
            throw $exception;
62
        });
63
    }
64
}
65