Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public function resolve(HandlerParameterAttributeInterface $attribute, ServerRequestInterface $request): mixed |
||
12 | { |
||
13 | if ($attribute::class !== Body::class) { |
||
14 | throw new \InvalidArgumentException(sprintf('Expected "%s", got "%s".', Body::class, $attribute::class)); |
||
15 | } |
||
16 | |||
17 | if ($attribute->getName() !== null) { |
||
|
|||
18 | return $request->getParsedBody()[$attribute->getName()] ?? null; |
||
19 | } |
||
20 | |||
21 | return $request->getParsedBody(); |
||
22 | } |
||
24 |