Conditions | 3 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function getValue( |
||
15 | ServerRequestInterface $request, |
||
16 | string $name, |
||
17 | ?string $type, |
||
18 | bool $required = false |
||
19 | ): mixed { |
||
20 | $key = $this->key ?? $this->convertNameToHeader($name); |
||
21 | $value = $request->getHeaderLine($key); |
||
22 | |||
23 | if ($required && $value === '') { |
||
24 | throw new ParameterException("Missing required header '$key'"); |
||
25 | } |
||
26 | |||
27 | return $this->filter($value, $type); |
||
28 | } |
||
36 |