Convert the dependency branch version.

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

@return string
324584
protected static function convertBrachVersion(AssetTypeInterface $assetType, $version)
    {
        $oldVersion = $version;
        $version = 'dev-'.$assetType->getVersionConverter()->convertVersion($version);

        if (!Validator::validateBranch($oldVersion)) {
            $version .= ' || '.$oldVersion;
        }

        return $version;
    }
1159723
public function getAssetContent($type, $hash, $version)
    {
        if (!$this->isCached($type, $hash, $version)) {
            return '';
        }
        
        $targetFile = $this->buildFilePath($type, $hash, $version);
        return $this->fileBackend->loadFromFile($targetFile);
    }
355269
protected static function getUrlFileDependencyVersion(AssetTypeInterface $assetType, $url, $version)
    {
        if ('#' !== $version) {
            return substr($version, 1);
        }

        if (preg_match('/(\d+)(\.\d+)(\.\d+)?(\.\d+)?/', $url, $match)) {
            return $assetType->getVersionConverter()->convertVersion($match[0]);
        }

        return '0.0.0.0';
    }
606814
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
    {
        $identity = $this->persistenceManager->getIdentifierByObject($source);
        switch (true) {
            case $source instanceof ImageVariant:
                if (!isset($convertedChildProperties['originalAsset']) || !is_array($convertedChildProperties['originalAsset'])) {
                    return null;
                }

                $convertedChildProperties['originalAsset']['__identity'] = $this->persistenceManager->getIdentifierByObject($source->getOriginalAsset());

                return [
                    '__identity' => $identity,
                    '__type' => \Neos\Media\Domain\Model\ImageVariant::class,
                    'originalAsset' => $convertedChildProperties['originalAsset'],
                    'adjustments' => $convertedChildProperties['adjustments']
                ];
            case $source instanceof AssetInterface:
                if (!isset($convertedChildProperties['resource']) || !is_array($convertedChildProperties['resource'])) {
                    return null;
                }

                $convertedChildProperties['resource']['__identity'] = $this->persistenceManager->getIdentifierByObject($source->getResource());

                return [
                    '__identity' => $identity,
                    '__type' => \Neos\Utility\TypeHandling::getTypeForValue($source),
                    'title' => $source->getTitle(),
                    'resource' => $convertedChildProperties['resource']
                ];
        }
    }
9182
private function getBranchAliases(ApiPackage\Version $version)
    {
        $extra = $version->getExtra();
        if (null !== $extra
            && isset($extra["branch-alias"])
            && is_array($extra["branch-alias"])
        ) {
            return $extra["branch-alias"];
        }

        return null;
    }
1054141
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildIndexEngineIndexVersionQuery::create()
            ->filterByIndexEngineIndex($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
1264332
protected function _resolveDependencies(Asset $asset, &$resolved = [], &$unresolved = [])
    {
        $unresolved[$asset->getAlias()] = $asset;

        foreach ($asset->getDependencies() as $dependency) {
            if (!Arr::key($dependency, $resolved)) {

                if (isset($unresolved[$dependency])) {
                    throw new Exception(sprintf(
                        'Circular asset dependency "%s > %s" detected.',
                        $asset->getAlias(),
                        $dependency
                    ));
                }

                if ($dep = $this->_collection->get($dependency)) {
                    $this->_resolveDependencies($dep, $resolved, $unresolved);
                } else {
                    throw new Exception("Undefined depends: $dependency");
                }
            }
        }

        $resolved[$asset->getAlias()] = $asset;
        unset($unresolved[$asset->getAlias()]);

        return $resolved;
    }
491688
public static function getVersion(string $version = ''): string
    {
        if ($version === '') {
            $version = PrettyVersions::getVersion('api-clients/pusher')->getFullVersion();
        }

        list($version, $hash) = explode('@', $version);

        if (strpos($version, 'dev') !== false) {
            return '0.0.1-' . $hash;
        }

        return $version;
    }
925616
public function getUsageCount(AssetInterface $asset)
    {
        $usageCount = 0;
        /** @var AssetUsageStrategyInterface $strategy */
        foreach ($this->getUsageStrategies() as $strategy) {
            $usageCount += $strategy->getUsageCount($asset);
        }

        return $usageCount;
    }
247977
public function asset($asset, $version = null)
    {
        $host = $this->request->getHost();
        $port = $this->request->getPort();
        $path = $this->request->getBasePath();

        if ('/' !== substr($asset, 1)) {
            $asset = '/'.$asset;
        }

        if (80 === $port) {
            $port = '';
        } else {
            $port = ':'.$port;
        }

        return '//'.$host.$port.$path.$asset;
    }
406726
public Version parseVersion(final String version) {
    checkNotNull(version);
    try {
      return versionScheme.parseVersion(version);
    }
    catch (InvalidVersionSpecificationException e) {
      throw Throwables.propagate(e);
    }
  }
366227
protected function _getVersionType($version)
    {
        if (strtolower($version) == 'latest') {
            return 'latest';
        }

        $parts = explode('.', $version);
        $count = count($parts);
        if (1 == $count) {
            return 'major';
        }
        if (2 == $count) {
            return 'minor';
        }
        if (3 < $count) {
            throw new Zend_Loader_Exception('Invalid version string provided');
        }
        return 'specific';
    }
1265272
public function url( $file = '', $version = '' ) {

		if ( empty( $version ) ) {
			$version = '?ver=' . Kecik::$version;
		}

		if ( ! empty( $file ) ) {
			return $this->BaseUrl . Config::get( 'path.assets' ) . '/' . $file . $version;
		} else {
			return $this->BaseUrl . Config::get( 'path.assets' ) . '/';
		}

	}
1019364
public function bundleVersionAction()
    {
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');

        $versionChecker = $this->container->get('kunstmaan_admin.versionchecker');
        if (!$versionChecker->isEnabled()) {
            return array('data' => null);
        }

        $data = null;

        try {
            $data = $versionChecker->check();
        } catch (\Exception $e) {
            $this->container->get('logger')->error(
                $e->getMessage(),
                array('exception' => $e)
            );
        }

        return array(
            'data' => $data,
        );
    }
1278884
public static Asset getAsset(AssetVersionSpec spec) {
        Asset match = null, assetVO = null;
        try {
            // Get asset from package based on asset version spec
            if (spec.getPackageName() != null) {
                // get all the versions of packages based on package name
                List<Package> allPackgeVOs = PackageCache.getAllPackages(spec.getPackageName());
                for (Package pkgVO : allPackgeVOs) {
                    for (Asset asset : pkgVO.getAssets()) {
                        if (spec.getName().equals(asset.getName())) {
                            if (asset.meetsVersionSpec(spec.getVersion()) && (match == null || asset.getVersion() > match.getVersion()))
                                match = asset;
                        }
                    }
                }
                if (match != null) {
                    if (!match.isLoaded())
                        assetVO = DataAccess.getProcessLoader().getAsset(match.getId());
                    else
                        assetVO = match;
                }
                else if (!spec.getVersion().equals("0")) { // check ASSET_REF DB table to retrieve from git history
                    AssetRef ref = AssetRefCache.getAssetRef(spec);
                    if (ref != null)
                        assetVO = AssetRefConverter.getAsset(ref);
                }
                return assetVO;
            }

            for (Asset asset : getAllAssets()) {
                if (spec.getName().equals(asset.getName())) {
                    if (asset.meetsVersionSpec(spec.getVersion()) && (match == null || asset.getVersion() > match.getVersion()))
                        match = asset;
                }
            }
            if (match != null && !match.isLoaded()) {
                assetVO = DataAccess.getProcessLoader().getAsset(match.getId());
            }
         //  If match == null, check ASSET_REF DB table to retrieve from git history
            if (match == null && !spec.getVersion().equals("0")) {
                AssetRef ref = AssetRefCache.getAssetRef(spec);
                if (ref != null)
                    assetVO = AssetRefConverter.getAsset(ref);
            }
        } catch (Exception ex) {
            logger.severeException("Failed to load asset: "+spec.toString()+ " : "+ex.getMessage(), ex);
        }
        return assetVO;
    }
1180079
public function mapOsVersion(?string $osVersion, ?string $osName = null): VersionInterface
    {
        return (new PlatformVersionMapper())->mapOsVersion($osVersion, $osName);
    }
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;
        }
    }