Rocketeer\Services\Connections\ConnectionsHandler::getRepositoryEndpoint PHP Method

getRepositoryEndpoint() public method

Get the URL to the Git repository.
public getRepositoryEndpoint ( ) : string
return string
    public function getRepositoryEndpoint()
    {
        // Get credentials
        $repository = $this->getRepositoryCredentials();
        $username = Arr::get($repository, 'username');
        $password = Arr::get($repository, 'password');
        $repository = Arr::get($repository, 'repository');
        // Add credentials if possible
        if ($username || $password) {
            $username = urlencode($username);
            $password = urlencode($password);
            // Build credentials chain
            $credentials = $password ? $username . ':' . $password : $username;
            $credentials .= '@';
            // Add them in chain
            $repository = preg_replace('#https://(.+)@#', 'https://', $repository);
            $repository = str_replace('https://', 'https://' . $credentials, $repository);
        }
        return $repository;
    }