protected function resolveDepsRecursive($module, $version, \ArrayObject $resolved){
    
        $module = strtolower($module);
        
        // replace if exists with lower version number
        if($resolved->offsetExists($module)){
            $new = new SoftwareVersion($version);
        
            // remember the greatest versions
            if($new->isGt($resolved[$module])){
                unset($resolved[$module]);
                $resolved[$module] = $version;
            }
        } else{
            $resolved[$module] = $version;
        }
        
        // ask for deps
        $deps = $this->getModuleDeps($module);
        
        if (array_key_exists($module, $deps)) {
            throw new \Exception(
                sprintf('Invalid dependency for module %s: dependency cannot point to self', $module));
        }
    
        foreach ($deps as $name => $depVersion){
    
            // make sure the same module doesn't get resolved again
            if(!$resolved->offsetExists($name)){
                $this->resolveDepsRecursive($name, $depVersion, $resolved);
            }
        }
        
        if ($resolved[$module] == $version) {
            unset($resolved[$module]);
            $resolved[$module] = $version;
        }
    }
protected function resolveDepsRecursive($module, $version, \ArrayObject $resolved){
    
        $module = strtolower($module);
        
        // replace if exists with lower version number
        if($resolved->offsetExists($module)){
            $new = new SoftwareVersion($version);
        
            // remember the greatest versions
            if($new->isGt($resolved[$module])){
                unset($resolved[$module]);
                $resolved[$module] = $version;
            }
        } else{
            $resolved[$module] = $version;
        }
        
        // ask for deps
        $deps = $this->getModuleDeps($module);
        
        if (array_key_exists($module, $deps)) {
            throw new \Exception(
                sprintf('Invalid dependency for module %s: dependency cannot point to self', $module));
        }
    
        foreach ($deps as $name => $depVersion){
    
            // make sure the same module doesn't get resolved again
            if(!$resolved->offsetExists($name)){
                $this->resolveDepsRecursive($name, $depVersion, $resolved);
            }
        }
        
        if ($resolved[$module] == $version) {
            unset($resolved[$module]);
            $resolved[$module] = $version;
        }
    }
protected function resolveDepsRecursive ( $ module , $ version , \ ArrayObject $ resolved ) { $ module = strtolower ( $ module ) ; // replace if exists with lower version number if ( $ resolved -> offsetExists ( $ module ) ) { $ new = new SoftwareVersion ( $ version ) ; // remember the greatest versions if ( $ new -> isGt ( $ resolved [ $ module ] ) ) { unset ( $ resolved [ $ module ] ) ; $ resolved [ $ module ] = $ version ; } } else { $ resolved [ $ module ] = $ version ; } // ask for deps $ deps = $ this -> getModuleDeps ( $ module ) ; if ( array_key_exists ( $ module , $ deps ) ) { throw new \ Exception ( sprintf ( 'Invalid dependency for module %s: dependency cannot point to self' , $ module ) ) ; } foreach ( $ deps as $ name => $ depVersion ) { // make sure the same module doesn't get resolved again
 if ( ! $ resolved -> offsetExists ( $ name ) ) { $ this -> resolveDepsRecursive ( $ name , $ depVersion , $ resolved ) ; } } if ( $ resolved [ $ module ] == $ version ) { unset ( $ resolved [ $ module ] ) ; $ resolved [ $ module ] = $ version ; } }
Resolve dependencies recursively. The level and order in module dependency
hierarchy defines the module's priority.

@param string $module
@param string $version
@param \ArrayObject $resolved
Resolve dependencies recursively . The level and order in module dependency hierarchy defines the module s priority .