public function resolve() : array
    {
        try{
            $app_required_modules = array_unique($this->required_modules);

            // get component dependency map
            $component_dependency_map = $this->getComponentDependencyMap($app_required_modules);

            // resolve component dependency
            $component_type_list = $this->resolveComponentDependencyMap($component_dependency_map);

            // add component modules to resolved list
            $component_module_list = [];
            foreach($component_type_list as $component_type){
                $component_module = $this->findComponentModuleByType($app_required_modules, $component_type);
                if (!$component_module){
                    throw new ModuleDependencyResolverException(
                        'Could not find component module: ' . $component_type
                    );
                }
                if (!in_array($component_module, $component_module_list)){
                    $component_module_list[] = $component_module;
                }
            }

            // merge module lists
            $module_list = array_merge($component_module_list, $app_required_modules);

            // get module dependency map
            $module_dependency_map = self::getModuleDependencyMap($module_list);

            // resolve module dependency
            $resolved_list = $this->resolveModuleDependencyMap($module_dependency_map);

            return $resolved_list;
        }
        catch(\Throwable $e)
        {
            throw new ModuleDependencyResolverException(__METHOD__ . ' failed: ' . $e->getMessage(), $e);
        }
    }
public function resolve() : array
    {
        try{
            $app_required_modules = array_unique($this->required_modules);

            // get component dependency map
            $component_dependency_map = $this->getComponentDependencyMap($app_required_modules);

            // resolve component dependency
            $component_type_list = $this->resolveComponentDependencyMap($component_dependency_map);

            // add component modules to resolved list
            $component_module_list = [];
            foreach($component_type_list as $component_type){
                $component_module = $this->findComponentModuleByType($app_required_modules, $component_type);
                if (!$component_module){
                    throw new ModuleDependencyResolverException(
                        'Could not find component module: ' . $component_type
                    );
                }
                if (!in_array($component_module, $component_module_list)){
                    $component_module_list[] = $component_module;
                }
            }

            // merge module lists
            $module_list = array_merge($component_module_list, $app_required_modules);

            // get module dependency map
            $module_dependency_map = self::getModuleDependencyMap($module_list);

            // resolve module dependency
            $resolved_list = $this->resolveModuleDependencyMap($module_dependency_map);

            return $resolved_list;
        }
        catch(\Throwable $e)
        {
            throw new ModuleDependencyResolverException(__METHOD__ . ' failed: ' . $e->getMessage(), $e);
        }
    }
public function resolve ( ) : array { try { $ app_required_modules = array_unique ( $ this -> required_modules ) ; // get component dependency map $ component_dependency_map = $ this -> getComponentDependencyMap ( $ app_required_modules ) ; // resolve component dependency $ component_type_list = $ this -> resolveComponentDependencyMap ( $ component_dependency_map ) ; // add component modules to resolved list $ component_module_list = [ ] ; foreach ( $ component_type_list as $ component_type ) { $ component_module = $ this -> findComponentModuleByType ( $ app_required_modules , $ component_type ) ; if ( ! $ component_module ) { throw new ModuleDependencyResolverException ( 'Could not find component module: ' . $ component_type ) ; } if ( ! in_array ( $ component_module , $ component_module_list ) ) { $ component_module_list [ ] = $ component_module ; } } // merge module lists $ module_list = array_merge ( $ component_module_list , $ app_required_modules ) ; // get module dependency map $ module_dependency_map = self :: getModuleDependencyMap ( $ module_list ) ; // resolve module dependency $ resolved_list = $ this -> resolveModuleDependencyMap ( $ module_dependency_map ) ; return $ resolved_list ; } catch ( \ Throwable $ e ) { throw new ModuleDependencyResolverException ( __METHOD__ . ' failed: ' . $ e -> getMessage ( ) , $ e ) ; } }
Return resolved modules

@return array

@throws ModuleDependencyResolverException
Return resolved modules