Psr7ResponsePrinter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A toString() 0 13 1
1
<?php
2
3
namespace Fitbug\Guzzle\SwaggerValidation;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
/**
8
 * Builds a string from a PSR7 Response.
9
 */
10
class Psr7ResponsePrinter extends AbstractPsr7MesssagePrinter implements Psr7ResponsePrinterInterface
11
{
12
    /**
13
     * Generate a pretty PS7 response.
14
     *
15
     * @param ResponseInterface $response
16
     *
17
     * @return string
18
     */
19 1
    public function toString(ResponseInterface $response)
20
    {
21 1
        $string = sprintf(
22 1
            "HTTP/%s %s %s\n",
23 1
            $response->getProtocolVersion(),
24 1
            $response->getStatusCode(),
25 1
            $response->getReasonPhrase()
26
        );
27
28 1
        $string .= $this->headersAndBody($response);
29
30 1
        return $string;
31
    }
32
}
33