Total Complexity | 7 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class PayloadArgumentResolver implements ArgumentValueResolverInterface |
||
11 | { |
||
12 | public function supports(Request $request, ArgumentMetadata $argument): bool |
||
13 | { |
||
14 | if ($argument->isVariadic()) { |
||
15 | return false; |
||
16 | } |
||
17 | |||
18 | $class = $argument->getType(); |
||
19 | |||
20 | if (null === $class) { |
||
21 | return false; |
||
22 | } |
||
23 | |||
24 | if (null === $request->attributes->get('data')) { |
||
25 | return false; |
||
26 | } |
||
27 | |||
28 | $attributes = RequestAttributesExtractor::extractAttributes($request); |
||
29 | |||
30 | if ($attributes['resource_class'] === $class) { |
||
31 | return true; |
||
32 | } |
||
33 | |||
34 | return is_subclass_of($attributes['resource_class'], $class); |
||
35 | } |
||
36 | |||
37 | public function resolve(Request $request, ArgumentMetadata $argument): \Generator |
||
44 | } |
||
45 | } |
||
46 |