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