Completed
Push — master ( 5e707a...73f162 )
by Stefan
02:28
created

Utils::normalizeHeaders()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Gemz\HttpClient;
4
5
class Utils
6
{
7
    /**
8
     * @param array<String> $headers
9
     *
10
     * @return array<String>
11
     */
12
    public static function normalizeHeaders(array $headers): array
13
    {
14
        $result = [];
15
16
        foreach ($headers as $header) {
17
            [$name, $value] = explode(':', $header, 2);
0 ignored issues
show
Bug introduced by
The variable $name does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $value does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
18
            $result[$name] = $value;
19
        }
20
21
        return $result;
22
    }
23
}
24