Conditions | 4 |
Paths | 4 |
Total Lines | 32 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
52 | 10 | private function getDependents( |
|
53 | string $packageName, |
||
54 | bool $returnContext, |
||
55 | array $context = [] |
||
56 | ): array { |
||
57 | 10 | if (!isset($context[$packageName])) { |
|
58 | 10 | $context[$packageName] = $this->repository->getDependents( |
|
59 | 10 | $packageName, |
|
60 | 10 | null, |
|
61 | 10 | false, |
|
62 | 10 | false |
|
63 | ); |
||
64 | |||
65 | 10 | foreach ($context[$packageName] as $key => $dependent) { |
|
66 | 4 | $dependentContext = $this->getDependents($key, true, $context); |
|
67 | 4 | $context = array_merge( |
|
68 | 4 | $context, |
|
69 | 4 | $dependentContext |
|
70 | ); |
||
71 | |||
72 | 4 | $context[$packageName] = array_merge( |
|
73 | 4 | $context[$packageName], |
|
74 | 4 | $dependentContext[$key] |
|
75 | ); |
||
76 | } |
||
77 | } |
||
78 | |||
79 | 10 | if (!$returnContext) { |
|
80 | 10 | return $context[$packageName]; |
|
81 | } |
||
82 | |||
83 | 4 | return $context; |
|
84 | } |
||
86 |