AbstractPsr7MesssagePrinter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A headersAndBody() 0 15 3
1
<?php
2
3
namespace Fitbug\Guzzle\SwaggerValidation;
4
5
use Psr\Http\Message\MessageInterface;
6
7
/**
8
 * Print a request or response PSR7 Message.
9
 */
10
abstract class AbstractPsr7MesssagePrinter
11
{
12
    /**
13
     * Generate the headers and body part of the message.
14
     *
15
     * @param MessageInterface $message
16
     *
17
     * @return string
18
     */
19 2
    protected function headersAndBody(MessageInterface $message)
20
    {
21 2
        $string = '';
22
23 2
        foreach ($message->getHeaders() as $name => $values) {
24 2
            foreach ($values as $value) {
25 2
                $string .= $name.': '.$value."\n";
26
            }
27
        }
28
29 2
        $string .= "\n";
30 2
        $string .= (string) $message->getBody();
31
32 2
        return $string;
33
    }
34
}
35