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