Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
7 | 7 | protected function parseHeaders(array $headers): array |
|
8 | { |
||
9 | 7 | $_headers = []; |
|
10 | |||
11 | 7 | foreach ($headers as $key => $value) { |
|
12 | /** |
||
13 | * RFC 7230, section 3.2.2 allows multiple Set-Cookie headers |
||
14 | * @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2 |
||
15 | */ |
||
16 | 7 | if (strtolower($key) === 'set-cookie') { |
|
17 | 1 | $_headers[$key] = $value; |
|
18 | 1 | continue; |
|
19 | } |
||
20 | |||
21 | 7 | $_headers[$key] = array_shift($value); |
|
22 | } |
||
23 | |||
24 | 7 | return $_headers; |
|
25 | } |
||
27 |