src/ModuleDependencyResolver.php
private function getModuleDependencyMap(array $modules) : array
    {
        $module_dependency_map = [];
        $child_module_list = [];
        foreach($modules as $key => $m)
        {
            $required_modules = call_user_func([$m, 'requiredModules']);

            $dependency = [
                $m => $required_modules,
            ];

            $module_dependency_map = $this->mergeDependencyMap($module_dependency_map, $dependency);

            foreach($required_modules as $required_module){
                if (!in_array($required_module, $modules)){
                    $child_module_list[] = $required_module;
                }
            }
        }

        if (!empty($child_module_list)){
            $child_module_dependency_map = $this->getModuleDependencyMap($child_module_list);
            $module_dependency_map = $this->mergeDependencyMap($module_dependency_map, $child_module_dependency_map);
        }

        return $module_dependency_map;
    }
private function getModuleDependencyMap(array $modules) : array
    {
        $module_dependency_map = [];
        $child_module_list = [];
        foreach($modules as $key => $m)
        {
            $required_modules = call_user_func([$m, 'requiredModules']);

            $dependency = [
                $m => $required_modules,
            ];

            $module_dependency_map = $this->mergeDependencyMap($module_dependency_map, $dependency);

            foreach($required_modules as $required_module){
                if (!in_array($required_module, $modules)){
                    $child_module_list[] = $required_module;
                }
            }
        }

        if (!empty($child_module_list)){
            $child_module_dependency_map = $this->getModuleDependencyMap($child_module_list);
            $module_dependency_map = $this->mergeDependencyMap($module_dependency_map, $child_module_dependency_map);
        }

        return $module_dependency_map;
    }
@param string[] $modules

@return array