private function getDependents(
        string $packageName,
        bool $returnContext,
        array $context = []
    ): array {
        if (!isset($context[$packageName])) {
            $context[$packageName] = $this->repository->getDependents(
                $packageName,
                null,
                false,
                false
            );

            foreach ($context[$packageName] as $key => $dependent) {
                $dependentContext = $this->getDependents($key, true, $context);
                $context          = array_merge(
                    $context,
                    $dependentContext
                );

                $context[$packageName] = array_merge(
                    $context[$packageName],
                    $dependentContext[$key]
                );
            }
        }

        if (!$returnContext) {
            return $context[$packageName];
        }

        return $context;
    }
private function getDependents(
        string $packageName,
        bool $returnContext,
        array $context = []
    ): array {
        if (!isset($context[$packageName])) {
            $context[$packageName] = $this->repository->getDependents(
                $packageName,
                null,
                false,
                false
            );

            foreach ($context[$packageName] as $key => $dependent) {
                $dependentContext = $this->getDependents($key, true, $context);
                $context          = array_merge(
                    $context,
                    $dependentContext
                );

                $context[$packageName] = array_merge(
                    $context[$packageName],
                    $dependentContext[$key]
                );
            }
        }

        if (!$returnContext) {
            return $context[$packageName];
        }

        return $context;
    }
private function getDependents ( string $ packageName , bool $ returnContext , array $ context = [ ] ) : array { if ( ! isset ( $ context [ $ packageName ] ) ) { $ context [ $ packageName ] = $ this -> repository -> getDependents ( $ packageName , null , false , false ) ; foreach ( $ context [ $ packageName ] as $ key => $ dependent ) { $ dependentContext = $ this -> getDependents ( $ key , true , $ context ) ; $ context = array_merge ( $ context , $ dependentContext ) ; $ context [ $ packageName ] = array_merge ( $ context [ $ packageName ] , $ dependentContext [ $ key ] ) ; } } if ( ! $ returnContext ) { return $ context [ $ packageName ] ; } return $ context ; }
Retrieves the dependents of a package in a recursive way.

@param string $packageName
@param bool   $returnContext
@param array  $context

@return array
Retrieves the dependents of a package in a recursive way .