| Conditions | 4 |
| Paths | 4 |
| Total Lines | 32 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 10 | public function getDependents( |
|
| 37 | string $packageName, |
||
| 38 | bool $returnContext, |
||
| 39 | array $context = [] |
||
| 40 | ): array { |
||
| 41 | 10 | if (!isset($context[$packageName])) { |
|
| 42 | 10 | $context[$packageName] = $this->repository->getDependents( |
|
| 43 | 10 | $packageName, |
|
| 44 | 10 | null, |
|
| 45 | 10 | false, |
|
| 46 | 10 | false |
|
| 47 | ); |
||
| 48 | |||
| 49 | 10 | foreach ($context[$packageName] as $key => $dependent) { |
|
| 50 | 4 | $dependentContext = $this->getDependents($key, true, $context); |
|
| 51 | 4 | $context = array_merge( |
|
| 52 | 4 | $context, |
|
| 53 | 4 | $dependentContext |
|
| 54 | ); |
||
| 55 | |||
| 56 | 4 | $context[$packageName] = array_merge( |
|
| 57 | 4 | $context[$packageName], |
|
| 58 | 4 | $dependentContext[$key] |
|
| 59 | ); |
||
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | 10 | if (!$returnContext) { |
|
| 64 | 10 | return $context[$packageName]; |
|
| 65 | } |
||
| 66 | |||
| 67 | 4 | return $context; |
|
| 68 | } |
||
| 70 |