Convert the dependency version.

@param AssetTypeInterface $assetType  The asset type
@param string             $dependency The dependency
@param string             $version    The version

@return string[] The new dependency and the new version
432710
public static function convertDependencyVersion(AssetTypeInterface $assetType, $dependency, $version)
    {
        $containsHash = false !== strpos($version, '#');
        $version = str_replace('#', '', $version);
        $version = empty($version) ? '*' : trim($version);
        $searchVersion = str_replace(array(' ', '<', '>', '=', '^', '~'), '', $version);

        // sha version or branch version
        // sha size: 4-40. See https://git-scm.com/book/tr/v2/Git-Tools-Revision-Selection#_short_sha_1
        if ($containsHash && preg_match('{^[0-9a-f]{4,40}$}', $version)) {
            $version = 'dev-default#'.$version;
        } elseif ('*' !== $version && !Validator::validateTag($searchVersion, $assetType) && !static::depIsRange($version)) {
            $version = static::convertBrachVersion($assetType, $version);
        }

        return array($dependency, $version);
    }
1272618
protected function resolveDependencies( array $dependencies )
	{
		$results = [];

		foreach( $dependencies as $dependency ) {
			// If the class is null, the dependency is a string or some other primitive type
			$results[] = !is_null( $class = $dependency->getClass() )
				? $this->resolveClass( $dependency )
				: null;
		}

		return $results;
	}
858867
public function getStabilityColor(array $dependency = array())
    {
        $stabilityColor = self::GREEN;
        if (!array_key_exists('outdated', $dependency)
            || !array_key_exists('stable', $dependency)
            || !array_key_exists('unknown', $dependency)
            || $dependency['unknown'] === true
        ) {
            $stabilityColor = self::GREY;
        } elseif ($dependency['outdated'] === true) {
            $stabilityColor = $dependency['stable'] === true ? self::RED : self::YELLOW;
        }

        return $stabilityColor;
    }
518539
public function getUsageReferences(AssetInterface $asset)
    {
        $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);
        if (isset($this->firstlevelCache[$assetIdentifier])) {
            return $this->firstlevelCache[$assetIdentifier];
        }

        $relatedNodes = array_map(function (NodeData $relatedNodeData) use ($asset) {
            return new AssetUsageInNodeProperties($asset,
                $relatedNodeData->getIdentifier(),
                $relatedNodeData->getWorkspace()->getName(),
                $relatedNodeData->getDimensionValues(),
                $relatedNodeData->getNodeType()->getName()
            );
        }, $this->getRelatedNodes($asset));

        $this->firstlevelCache[$assetIdentifier] = $relatedNodes;
        return $this->firstlevelCache[$assetIdentifier];
    }
1280364
public static function createAssetOptions(array $config, $assetType)
    {
        $options = array();

        foreach ($config as $key => $value) {
            if (0 === strpos($key, $assetType.'-')) {
                $key = substr($key, \strlen($assetType) + 1);
                $options[$key] = $value;
            }
        }

        return $options;
    }
1150608
protected function doDataIntegrityAssertions(VersionEntityInterface $version)
    {
        $content = $version->getContentAsArray();
        $action = $version->getAction();

        if (($content == null || (is_array($content) && count($content) === 0))
            && $action !== VersionActions::DEPUBLISH
        ) {
            throw new \Exception('Found missing content for an action type that should have content');
        }
    }
346514
private function InstallDependency(BundleDependency $dependency)
    {
        $bundle = $dependency->BundleName();
        if (array_key_exists($bundle, $this->failedBundles))
        {
            return false;
        }
        $installedVersion = $this->InstalledVersion($bundle);
        $manifest = ClassFinder::Manifest($bundle);
        if (!$installedVersion || version_compare($installedVersion, $manifest->Version()) < 0)
        {
            if (!$this->InstallBundle($bundle))
            {
                return false;
            }
        }
        return true;
    }
745744
@Override
    protected String resolveVersion(final MavenDependency dependency) throws IllegalArgumentException {
        return new ResolveVersionFromMetadataTask(dependency).execute(this.getMavenWorkingSession());
    }
1074303
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;
        }
    }
677677
protected function get_default_handler( $dependency ) {
		switch ( $dependency ) {
			case self::KEY_STYLES:
				return self::DEFAULT_STYLE_HANDLER;
			case self::KEY_SCRIPTS:
				return self::DEFAULT_SCRIPT_HANDLER;
			default:
				return null;
		}
	}
1318230
protected function replaceAssetDependencies(&$assets)
    {
        foreach ($assets as $asset => $value) {
            if (empty($replaces = $value['replaces'])) {
                continue;
            }

            foreach ($replaces as $replace) {
                unset($assets[$replace]);
            }

            $this->resolveDependenciesForAsset($assets, $asset, $replaces);
        }
    }
289780
private function loadPackageAssets($packageVariant, Package $package)
	{
		$variants = $package->getVariants();
		$requiredVariant = $variants[$packageVariant];

		if (isset($requiredVariant['scripts'])) {
			$scripts = [];
			foreach ($requiredVariant['scripts'] as $script) {
				$scripts[] = new Asset($package, $script);
			}
			$this->assetsLoader->addScripts($scripts);
		}

		if (isset($requiredVariant['styles'])) {
			$styles = [];
			foreach ($requiredVariant['styles'] as $style) {
				$styles[] = new Asset($package, $style);
			}
			$this->assetsLoader->addStyles($styles);
		}
	}
1059052
public function loadRelations($contentId, $contentVersionNo = null, $relationType = null)
    {
        try {
            return $this->innerGateway->loadRelations($contentId, $contentVersionNo, $relationType);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
6558
private function cacheAsset(AssetInterface $asset)
    {
    	return $this->configuration->getCacheEnabled()
    	? new AssetCache($asset, new FilesystemCache($this->configuration->getCachePath()))
    	: $asset;
    }
1180079
public function mapOsVersion(?string $osVersion, ?string $osName = null): VersionInterface
    {
        return (new PlatformVersionMapper())->mapOsVersion($osVersion, $osName);
    }
1290533
public function orDependency(Dependency $dependency) {
        if ($dependency === $this)
            return $this;
        return ChainedDependency::create($this)->orDependency($dependency);
    }
170235
function initEntry(dependency, version) {
    if (!allDependencies.hasOwnProperty(dependency)) {
        allDependencies[dependency] = {};
    }

    var versions = allDependencies[dependency];

    if (!versions.hasOwnProperty(version)) {
        versions[version] = [];
    }
}