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