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