Code Duplication    Length = 19-19 lines in 2 locations

Collector/ProfilePlugin.php 1 location

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

Collector/StackPlugin.php 1 location

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