Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function __invoke(ResourceObject $ro): array |
||
19 | { |
||
20 | $refParameters = (new ReflectionMethod($ro::class, 'onGet'))->getParameters(); |
||
21 | $getQuery = []; |
||
22 | $query = $ro->uri->query; |
||
23 | foreach ($refParameters as $parameter) { |
||
24 | if (! isset($query[$parameter->name])) { |
||
25 | throw new UnmatchedQuery(sprintf('%s %s', $ro->uri->method, (string) $ro->uri)); |
||
26 | } |
||
27 | |||
28 | /** @psalm-suppress MixedAssignment */ |
||
29 | $getQuery[$parameter->name] = $query[$parameter->name]; |
||
30 | } |
||
31 | |||
32 | return $getQuery; |
||
33 | } |
||
35 |