src/ModuleDependencyResolver.php
private function getComponentDependencyList(string $component, array $component_dependency_map, array $cyclic_reference_list) : array
    {
        if (!in_array($component, $cyclic_reference_list)){
            $cyclic_reference_list[] = $component;
        }
        else{
            throw new CyclicReferencedComponentException($component, $cyclic_reference_list);
        }

        $dependency_list = [];
        $depended_components = $component_dependency_map[$component] ?? [];
        foreach($depended_components as $depended_component){
            $list = $this->getComponentDependencyList($depended_component, $component_dependency_map, $cyclic_reference_list);
            if (!empty($list)){
                foreach($list as $c){
                    if (!in_array($c, $dependency_list)){
                        $dependency_list[] = $c;
                    }
                }
            }
            if (!in_array($depended_component, $dependency_list)) {
                $dependency_list[] = $depended_component;
            }
        }
        return $dependency_list;
    }
private function getComponentDependencyList(string $component, array $component_dependency_map, array $cyclic_reference_list) : array
    {
        if (!in_array($component, $cyclic_reference_list)){
            $cyclic_reference_list[] = $component;
        }
        else{
            throw new CyclicReferencedComponentException($component, $cyclic_reference_list);
        }

        $dependency_list = [];
        $depended_components = $component_dependency_map[$component] ?? [];
        foreach($depended_components as $depended_component){
            $list = $this->getComponentDependencyList($depended_component, $component_dependency_map, $cyclic_reference_list);
            if (!empty($list)){
                foreach($list as $c){
                    if (!in_array($c, $dependency_list)){
                        $dependency_list[] = $c;
                    }
                }
            }
            if (!in_array($depended_component, $dependency_list)) {
                $dependency_list[] = $depended_component;
            }
        }
        return $dependency_list;
    }
private function getComponentDependencyList ( string $ component , array $ component_dependency_map , array $ cyclic_reference_list ) : array { if ( ! in_array ( $ component , $ cyclic_reference_list ) ) { $ cyclic_reference_list [ ] = $ component ; } else { throw new CyclicReferencedComponentException ( $ component , $ cyclic_reference_list ) ; } $ dependency_list = [ ] ; $ depended_components = $ component_dependency_map [ $ component ] ?? [ ] ; foreach ( $ depended_components as $ depended_component ) { $ list = $ this -> getComponentDependencyList ( $ depended_component , $ component_dependency_map , $ cyclic_reference_list ) ; if ( ! empty ( $ list ) ) { foreach ( $ list as $ c ) { if ( ! in_array ( $ c , $ dependency_list ) ) { $ dependency_list [ ] = $ c ; } } } if ( ! in_array ( $ depended_component , $ dependency_list ) ) { $ dependency_list [ ] = $ depended_component ; } } return $ dependency_list ; }
@param string $component
@param array $component_dependency_map
@param array $cyclic_reference_list

@return string[]

@throws CyclicReferencedComponentException
@param string $component @param array $component_dependency_map @param array $cyclic_reference_list