| Conditions | 4 |
| Paths | 4 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | private static function parseHeaders(string $string): array |
||
| 13 | { |
||
| 14 | $headers = []; |
||
| 15 | $lines = explode("\n", $string); |
||
| 16 | $name = null; |
||
| 17 | |||
| 18 | foreach ($lines as $line) { |
||
| 19 | $line = self::convertString($line); |
||
| 20 | |||
| 21 | if ($line === '') { |
||
| 22 | continue; |
||
| 23 | } |
||
| 24 | |||
| 25 | if (self::isHeaderDefinition($line)) { |
||
| 26 | $pieces = array_map('trim', explode(':', $line, 2)); |
||
| 27 | list($name, $value) = $pieces; |
||
| 28 | |||
| 29 | $headers[$name] = $value; |
||
| 30 | continue; |
||
| 31 | } |
||
| 32 | |||
| 33 | $value = $headers[$name] ?? ''; |
||
| 34 | $headers[$name] = $value.$line; |
||
| 35 | } |
||
| 36 | |||
| 37 | return $headers; |
||
| 38 | } |
||
| 39 | |||
| 57 |