Conditions | 6 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public function __invoke(array $target, array ...$args): array |
||
11 | { |
||
12 | [$key] = $args[0]; |
||
13 | |||
14 | if (isset($target[$key]) && is_array($target[$key])) { |
||
15 | if (isset($target[$key]["id"])) { |
||
16 | $target[$key] = $target[$key]["id"]; |
||
17 | } |
||
18 | |||
19 | if (is_object($target[$key]) && method_exists($target[$key], "getId")) { |
||
20 | $target[$key] = $target[$key]->getId(); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | return $target; |
||
25 | } |
||
27 |