Conditions | 3 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 ?? $name; |
||
21 | $value = $request->getAttribute('route:{' . $key . '}'); |
||
22 | |||
23 | if ($required && $value === null) { |
||
24 | throw new ParameterException("Missing required path parameter '$key'"); |
||
25 | } |
||
26 | |||
27 | return $this->filter($value, $type); |
||
28 | } |
||
30 |