Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
36 | 5 | protected function init(): void |
|
37 | { |
||
38 | // loop through each string and break on ':' |
||
39 | 5 | foreach ((array)$this->getValue() as $header) { |
|
40 | 5 | $position = strpos($header, ':'); |
|
41 | |||
42 | 5 | if ($position === false) { |
|
43 | 1 | throw new RuntimeException('Retrofit: Header in an incorrect format. Expected "Name: value"'); |
|
44 | } |
||
45 | |||
46 | 4 | $name = trim(substr($header, 0, $position)); |
|
47 | 4 | $value = trim(substr($header, $position + 1)); |
|
48 | |||
49 | 4 | $this->value[$name] = $value; |
|
50 | } |
||
51 | 4 | } |
|
52 | } |
||
53 |