Code Duplication    Length = 26-27 lines in 2 locations

src/Debug/Formatter/Guzzle/RequestFormatter.php 1 location

@@ 12-37 (lines=26) @@
9
/**
10
 * @author Emil Kilhage
11
 */
12
class RequestFormatter extends AbstractMessageFormatter
13
{
14
    /**
15
     * @param RequestInterface $request
16
     * @return string
17
     * @throws FormatterException
18
     */
19
    public function format($request)
20
    {
21
        $body = $this->formatBody($request);
22
23
        $sections = [
24
            'Request Method' => $request->getMethod(),
25
            'Request Url' => $request->getUrl(),
26
            'Request Port' => $request->getPort(),
27
            'Request Headers' => [],
28
            'Request Body' => $body,
29
        ];
30
31
        $sections['Request Headers'] = $this->formatHeaders($request);
32
33
        $message = FormatterHelper::formatSections($sections);
34
35
        return $message;
36
    }
37
}
38

src/Debug/Formatter/Guzzle/ResponseFormatter.php 1 location

@@ 12-38 (lines=27) @@
9
/**
10
 * @author Emil Kilhage
11
 */
12
class ResponseFormatter extends AbstractMessageFormatter
13
{
14
    /**
15
     * @param ResponseInterface $response
16
     * @return string
17
     * @throws FormatterException
18
     */
19
    public function format($response)
20
    {
21
        $body = $this->formatBody($response);
22
23
        $sections = [
24
            'Response Status Code' => $response->getStatusCode(),
25
            'Response Protocol Version' => $response->getProtocolVersion(),
26
            'Response Reason Phrase' => $response->getReasonPhrase(),
27
            'Response Effective Url' => $response->getEffectiveUrl(),
28
            'Response Headers' => [],
29
            'Response Body' => $body,
30
        ];
31
32
        $sections['Response Headers'] = $this->formatHeaders($response);
33
34
        $message = FormatterHelper::formatSections($sections);
35
36
        return $message;
37
    }
38
}
39