| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 136 | private static function headers(RequestInterface $request) |
|
| 33 | { |
||
| 34 | 136 | $headers = $request->getHeaders(); |
|
| 35 | |||
| 36 | 136 | unset($headers['host']); |
|
| 37 | 136 | unset($headers['Host']); |
|
| 38 | |||
| 39 | 136 | $headerLines = []; |
|
| 40 | 136 | foreach ($headers as $name => $value) { |
|
| 41 | 127 | $value = is_array($value) ? $value : [$value]; |
|
| 42 | 127 | $normalizedName = (new HeaderNameNormalizer())->normalize($name); |
|
| 43 | |||
| 44 | 127 | $headerLines[$normalizedName] = $normalizedName.': '.implode(',', $value).self::CRLF; |
|
| 45 | 136 | } |
|
| 46 | |||
| 47 | 136 | ksort($headerLines); |
|
| 48 | |||
| 49 | 136 | $host = $request->getUri()->getHost(); |
|
| 50 | |||
| 51 | 136 | return "host: $host".self::CRLF.implode($headerLines).self::CRLF; |
|
| 52 | } |
||
| 53 | |||
| 67 |