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