Conditions | 4 |
Paths | 5 |
Total Lines | 27 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
14 | public function introspect(MessageInterface $message, array $headers): void |
||
15 | { |
||
16 | if (!$this->supports($message)) { |
||
17 | throw new UnsupportedMessage($message, RequestInterface::class); |
||
18 | } |
||
19 | |||
20 | assert($message instanceof RequestInterface); |
||
21 | |||
22 | // mandatory, clearing the line |
||
23 | // todo : check how to clear without this echo... |
||
24 | echo "\n"; |
||
25 | |||
26 | $introspect = [ |
||
27 | 'Request' => "{$message->getMethod()} {$message->getUri()}", |
||
28 | ]; |
||
29 | |||
30 | foreach ($headers as $header) { |
||
31 | $introspect["Request {$header}"] = $message->getHeaderLine($header); |
||
32 | } |
||
33 | |||
34 | $body = (string) $message->getBody(); |
||
35 | |||
36 | if (!empty($body)) { |
||
37 | $introspect['Request Body'] = $body; |
||
38 | } |
||
39 | |||
40 | VarDumper::dump($introspect); |
||
41 | } |
||
50 |