src/Composer/Package/Loader/ArrayLoader.php
public function getBranchAlias(array $config)
    {
        if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
            || !isset($config['extra']['branch-alias'])
            || !is_array($config['extra']['branch-alias'])
        ) {
            return;
        }

        foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
            // ensure it is an alias to a -dev package
            if ('-dev' !== substr($targetBranch, -4)) {
                continue;
            }

            // normalize without -dev and ensure it's a numeric branch that is parseable
            $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
            if ('-dev' !== substr($validatedTargetBranch, -4)) {
                continue;
            }

            // ensure that it is the current branch aliasing itself
            if (strtolower($config['version']) !== strtolower($sourceBranch)) {
                continue;
            }

            // If using numeric aliases ensure the alias is a valid subversion
            if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
                && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
                && (stripos($targetPrefix, $sourcePrefix) !== 0)
            ) {
                continue;
            }

            return $validatedTargetBranch;
        }
    }
public function getBranchAlias(array $config)
    {
        if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
            || !isset($config['extra']['branch-alias'])
            || !is_array($config['extra']['branch-alias'])
        ) {
            return;
        }

        foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
            // ensure it is an alias to a -dev package
            if ('-dev' !== substr($targetBranch, -4)) {
                continue;
            }

            // normalize without -dev and ensure it's a numeric branch that is parseable
            $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
            if ('-dev' !== substr($validatedTargetBranch, -4)) {
                continue;
            }

            // ensure that it is the current branch aliasing itself
            if (strtolower($config['version']) !== strtolower($sourceBranch)) {
                continue;
            }

            // If using numeric aliases ensure the alias is a valid subversion
            if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
                && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
                && (stripos($targetPrefix, $sourcePrefix) !== 0)
            ) {
                continue;
            }

            return $validatedTargetBranch;
        }
    }
public function getBranchAlias ( array $ config ) { if ( ( 'dev-' !== substr ( $ config [ 'version' ] , 0 , 4 ) && '-dev' !== substr ( $ config [ 'version' ] , - 4 ) ) || ! isset ( $ config [ 'extra' ] [ 'branch-alias' ] ) || ! is_array ( $ config [ 'extra' ] [ 'branch-alias' ] ) ) { return ; } foreach ( $ config [ 'extra' ] [ 'branch-alias' ] as $ sourceBranch => $ targetBranch ) { // ensure it is an alias to a -dev package if ( '-dev' !== substr ( $ targetBranch , - 4 ) ) { continue ; } // normalize without -dev and ensure it's a numeric branch that is parseable $ validatedTargetBranch = $ this -> versionParser -> normalizeBranch ( substr ( $ targetBranch , 0 , - 4 ) ) ; if ( '-dev' !== substr ( $ validatedTargetBranch , - 4 ) ) { continue ; } // ensure that it is the current branch aliasing itself if ( strtolower ( $ config [ 'version' ] ) !== strtolower ( $ sourceBranch ) ) { continue ; } // If using numeric aliases ensure the alias is a valid subversion if ( ( $ sourcePrefix = $ this -> versionParser -> parseNumericAliasPrefix ( $ sourceBranch ) ) && ( $ targetPrefix = $ this -> versionParser -> parseNumericAliasPrefix ( $ targetBranch ) ) && ( stripos ( $ targetPrefix , $ sourcePrefix ) !== 0 ) ) { continue ; } return $ validatedTargetBranch ; } }
Retrieves a branch alias (dev-master => 1.0.x-dev for example) if it exists

@param  array       $config the entire package config
@return string|null normalized version of the branch alias or null if there is none
Retrieves a branch alias ( dev - master = > 1 . 0 . x - dev for example ) if it exists