| Total Complexity | 7 | 
| Total Lines | 42 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1);  | 
            ||
| 12 | final class JsonAdapter implements Adapter  | 
            ||
| 13 | { | 
            ||
| 14 | public function introspect(MessageInterface $message, array $headers): void  | 
            ||
| 15 |     { | 
            ||
| 16 |         if (!$this->supports($message)) { | 
            ||
| 17 | throw new UnsupportedMessage($message, ResponseInterface::class);  | 
            ||
| 18 | }  | 
            ||
| 19 | |||
| 20 | // mandatory, clearing the line  | 
            ||
| 21 | // todo : check how to clear without this echo...  | 
            ||
| 22 | echo "\n";  | 
            ||
| 23 | |||
| 24 | $dump = [  | 
            ||
| 25 |             'Response Status' => "{$message->getStatusCode()} {$message->getReasonPhrase()}", | 
            ||
| 26 | ];  | 
            ||
| 27 | |||
| 28 |         foreach ($headers as $header) { | 
            ||
| 29 |             $dump["Response {$header}"] = $message->getHeaderLine($header); | 
            ||
| 30 | }  | 
            ||
| 31 | |||
| 32 | $body = (string) $message->getBody();  | 
            ||
| 33 | |||
| 34 |         if (!empty($body)) { | 
            ||
| 35 | $dump['Response Body'] = json_decode($body);  | 
            ||
| 36 | }  | 
            ||
| 37 | |||
| 38 | VarDumper::dump($dump);  | 
            ||
| 39 | }  | 
            ||
| 40 | |||
| 41 | public function supports(MessageInterface $message): bool  | 
            ||
| 54 | }  | 
            ||
| 55 | }  | 
            ||
| 56 |