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