| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function resolve(string $resource, array $ids) |
||
| 34 | { |
||
| 35 | $shortKey = Arr::get(static::$resolvers, $resource.'.short_key', $resource); |
||
| 36 | $resolver = Arr::get(static::$resolvers, $resource.'.resolver'); |
||
| 37 | |||
| 38 | if (!is_callable($resolver)) { |
||
| 39 | throw new \InvalidArgumentException('Resolver for given resource ('.$resource.') was not found.'); |
||
| 40 | } |
||
| 41 | |||
| 42 | return [ |
||
| 43 | 'short_key' => $shortKey, |
||
| 44 | 'resources' => call_user_func_array($resolver, [$ids]), |
||
| 45 | ]; |
||
| 46 | } |
||
| 47 | } |
||
| 48 |