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