protected function generateBaseUrl($sourceUrl)
    {
        if ($this->isSshUrl($sourceUrl)) {
            return $this->transformSshUrlIntoHttp($sourceUrl);
        }

        $sourceUrl = parse_url($sourceUrl);
        $pos = strrpos($sourceUrl['path'], '.git');

        return sprintf(
            '%s://%s%s',
            $sourceUrl['scheme'],
            $sourceUrl['host'],
            $pos === false ? $sourceUrl['path'] : substr($sourceUrl['path'], 0, strrpos($sourceUrl['path'], '.git'))
        );
    }
protected function generateBaseUrl($sourceUrl)
    {
        if ($this->isSshUrl($sourceUrl)) {
            return $this->transformSshUrlIntoHttp($sourceUrl);
        }

        $sourceUrl = parse_url($sourceUrl);
        $pos = strrpos($sourceUrl['path'], '.git');

        return sprintf(
            '%s://%s%s',
            $sourceUrl['scheme'],
            $sourceUrl['host'],
            $pos === false ? $sourceUrl['path'] : substr($sourceUrl['path'], 0, strrpos($sourceUrl['path'], '.git'))
        );
    }
protected function generateBaseUrl ( $ sourceUrl ) { if ( $ this -> isSshUrl ( $ sourceUrl ) ) { return $ this -> transformSshUrlIntoHttp ( $ sourceUrl ) ; } $ sourceUrl = parse_url ( $ sourceUrl ) ; $ pos = strrpos ( $ sourceUrl [ 'path' ] , '.git' ) ; return sprintf ( '%s://%s%s' , $ sourceUrl [ 'scheme' ] , $ sourceUrl [ 'host' ] , $ pos === false ? $ sourceUrl [ 'path' ] : substr ( $ sourceUrl [ 'path' ] , 0 , strrpos ( $ sourceUrl [ 'path' ] , '.git' ) ) ) ; }
Generates the canonical http url for a repository.

It ensures there is no .git part in http url. It also supports ssh urls
by converting them in their http equivalent format.

@param string $sourceUrl

@return string
Generates the canonical http url for a repository .