src/Composer/Repository/Vcs/GitLabDriver.php
public function initialize()
    {
        if (!preg_match(self::URL_REGEX, $this->url, $match)) {
            throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
        }

        $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
        $configuredDomains = $this->config->get('gitlab-domains');
        $urlParts = explode('/', $match['parts']);

        $this->scheme = !empty($match['scheme'])
            ? $match['scheme']
            : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
        ;
        $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);

        if (!empty($match['port']) && true === is_numeric($match['port'])) {
            // If it is an HTTP based URL, and it has a port
            $this->portNumber = (int) $match['port'];
        }

        $this->namespace = implode('/', $urlParts);
        $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);

        $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);

        $this->fetchProject();
    }
public function initialize()
    {
        if (!preg_match(self::URL_REGEX, $this->url, $match)) {
            throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
        }

        $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
        $configuredDomains = $this->config->get('gitlab-domains');
        $urlParts = explode('/', $match['parts']);

        $this->scheme = !empty($match['scheme'])
            ? $match['scheme']
            : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
        ;
        $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);

        if (!empty($match['port']) && true === is_numeric($match['port'])) {
            // If it is an HTTP based URL, and it has a port
            $this->portNumber = (int) $match['port'];
        }

        $this->namespace = implode('/', $urlParts);
        $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);

        $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);

        $this->fetchProject();
    }
public function initialize ( ) { if ( ! preg_match ( self :: URL_REGEX , $ this -> url , $ match ) ) { throw new \ InvalidArgumentException ( 'The URL provided is invalid. It must be the HTTP URL of a GitLab project.' ) ; } $ guessedDomain = ! empty ( $ match [ 'domain' ] ) ? $ match [ 'domain' ] : $ match [ 'domain2' ] ; $ configuredDomains = $ this -> config -> get ( 'gitlab-domains' ) ; $ urlParts = explode ( '/' , $ match [ 'parts' ] ) ; $ this -> scheme = ! empty ( $ match [ 'scheme' ] ) ? $ match [ 'scheme' ] : ( isset ( $ this -> repoConfig [ 'secure-http' ] ) && $ this -> repoConfig [ 'secure-http' ] === false ? 'http' : 'https' ) ; $ this -> originUrl = $ this -> determineOrigin ( $ configuredDomains , $ guessedDomain , $ urlParts ) ; if ( ! empty ( $ match [ 'port' ] ) && true === is_numeric ( $ match [ 'port' ] ) ) { // If it is an HTTP based URL, and it has a port $ this -> portNumber = ( int ) $ match [ 'port' ] ; } $ this -> namespace = implode ( '/' , $ urlParts ) ; $ this -> repository = preg_replace ( '#(\.git)$#' , '' , $ match [ 'repo' ] ) ; $ this -> cache = new Cache ( $ this -> io , $ this -> config -> get ( 'cache-repo-dir' ) . '/' . $ this -> originUrl . '/' . $ this -> namespace . '/' . $ this -> repository ) ; $ this -> fetchProject ( ) ; }
Extracts information from the repository url.

SSH urls use https by default. Set "secure-http": false on the repository config to use http instead.

{@inheritDoc}
Extracts information from the repository url .