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

Utils   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalizeHeaders() 0 11 2
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