Conditions | 4 |
Paths | 5 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
16 | public function introspect(MessageInterface $message, array $headers): void |
||
17 | { |
||
18 | if (!$this->supports($message)) { |
||
19 | throw new UnsupportedMessage($message, ResponseInterface::class); |
||
20 | } |
||
21 | |||
22 | assert($message instanceof ResponseInterface); |
||
23 | |||
24 | echo "\n"; |
||
25 | |||
26 | printf(self::TEMPLATE, 'Response status', "{$message->getStatusCode()} {$message->getReasonPhrase()}"); |
||
27 | |||
28 | foreach ($headers as $header) { |
||
29 | printf(self::TEMPLATE, "Response {$header}", $message->getHeaderLine($header)); |
||
30 | } |
||
31 | |||
32 | $body = (string) $message->getBody(); |
||
33 | |||
34 | if (!empty($body)) { |
||
35 | echo "\n{$body}"; |
||
36 | } |
||
37 | |||
38 | echo "\n"; |
||
39 | } |
||
46 |