Return the resolved URL for this service.

@param bool $insecure (optional) Set to true to request the insecure version of this service.

@return UriInterface
480733
public function getUrl(bool $insecure = false): UriInterface
    {
        $url = $this->resolveAllUrlsResponse[array_rand($this->resolveAllUrlsResponse)];

        if ($insecure) {
            return $url;
        }

        return $url->withScheme('https');
    }
1231427
public function getSecureURL($expires = 60) {
		if($this->owner instanceof \Image_Cached || $this->owner instanceof \CdnImage_Cached) {
			return;
		}

		/** @var \FileContent $pointer */
		$pointer = $this->owner->obj('CDNFile');

		if($pointer->exists()) {
			$reader = $this->reader();
			if ($reader && $this->owner->canView() && method_exists($reader, 'getSecureURL')) {
				return $reader->getSecureURL($expires);
			}
		}
	}
750176
public function asset($path, $secure = null)
    {
        if ($this->isValidUrl($path)) {
            return $path;
        }

        // Once we get the root URL, we will check to see if it contains an index.php
        // file in the paths. If it does, we will remove it since it is not needed
        // for asset paths, but only for routes to endpoints in the application.
        $root = $this->newGetRootUrl($this->getScheme($secure));

        return $this->removeIndex($root).'/'.trim($path, '/');
    }
255383
public function getUri()
    {
        $schema = "http";

        if ($this->isSecure) {
            $schema = "https";
        }
        
        $uri = sprintf(
            "%s://%s%s",
            $schema,
            $this->serverName,
            $this->path
        );
        
        return new Uri($uri);
    }
862051
public function getCurrentUrl()
    {
        $oUtilsServer = \OxidEsales\Eshop\Core\Registry::getUtilsServer();

        $aServerParams["HTTPS"] = $oUtilsServer->getServerVar("HTTPS");
        $aServerParams["HTTP_X_FORWARDED_PROTO"] = $oUtilsServer->getServerVar("HTTP_X_FORWARDED_PROTO");
        $aServerParams["HTTP_HOST"] = $oUtilsServer->getServerVar("HTTP_HOST");
        $aServerParams["REQUEST_URI"] = $oUtilsServer->getServerVar("REQUEST_URI");

        $sProtocol = "http://";

        if (isset($aServerParams['HTTPS']) && (($aServerParams['HTTPS'] == 'on' || $aServerParams['HTTPS'] == 1))
            || (isset($aServerParams['HTTP_X_FORWARDED_PROTO']) && $aServerParams['HTTP_X_FORWARDED_PROTO'] == 'https')
        ) {
            $sProtocol = 'https://';
        }

        return $sProtocol . $aServerParams['HTTP_HOST'] . $aServerParams['REQUEST_URI'];
    }
228215
public function https($useHTTPS = true)
    {
        if ($useHTTPS) {
            $this->https = true;
        } else {
            $this->https = false;
        }

        return $this;
    }
1328120
public static function setHttPortToUrl(string $url, bool $https = null): string
    {
        if (preg_match("/([a-z0-9]{2,9})\:([0-9]+)/Ui", $url)) {
            return $url;
        }
        $urlArray = explode(self::DELIMITER, $url);
        $port     = self::DEFAULT_PORT_HTTP;
        if (($https === true || $urlArray[0] == 'https' || static::isSecure($https, $urlArray[0])) && $https !== false) {
            $port = self::DEFAULT_PORT_HTTPS;
        }

        return $urlArray[0] . self::DELIMITER . static::addPort($urlArray[1], $port);
    }
1007351
public function to( $path, $extra = [], $secure = null )
	{
		// First we will check if the URL is already a valid URL. If it is we will not
		// try to generate a new one but will simply return the URL as is, which is
		// convenient since developers do not always have to check if it's valid.
		if ( $this->isValidUrl( $path ) )
			return $path;

		$scheme = $this->getScheme( $secure );

		$extra = $this->formatParameters( $extra );

		$tail = implode( '/', array_map( 'rawurlencode', (array) $extra ) );

		// Once we have the scheme we will compile the "tail" by collapsing the values
		// into a single string delimited by slashes. This just makes it convenient
		// for passing the array of parameters to this URL as a list of segments.
		$root = $this->getRootUrl( $scheme );

		if ( ( $queryPosition = strpos( $path, '?' ) ) !== false )
		{
			$query = mb_substr( $path, $queryPosition );
			$path = mb_substr( $path, 0, $queryPosition );
		}
		else
			$query = '';

		return $this->trimUrl( $root, $path, $tail ) . $query;
	}
565786
public function getProviderId(): \Psr\Http\Message\UriInterface
    {
        if (!$this->providerId) {
            return new Uri();
        }

        return $this->providerId;
    }
781603
public function urlWithParams($path = null, $qs = [], $secure = null)
    {
        $url = app('url')->to($path, $secure);
        if (count($qs)){
            foreach($qs as $key => $value){
                $qs[$key] = sprintf('%s=%s',$key, urlencode($value));
            }
            $url = sprintf('%s?%s', $url, implode('&', $qs));
        }
        return $url;
    }
724155
public function to($path, $extra = [], $secure = null)
    {
        // First we will check if the URL is already a valid URL. If it is we will not
        // try to generate a new one but will simply return the URL as is, which is
        // convenient since developers do not always have to check if it's valid.
        if ($this->isValidUrl($path)) {
            return $path;
        }

        $tail = implode('/', array_map(
            'rawurlencode', (array) $this->formatParameters($extra))
        );

        // Once we have the scheme we will compile the "tail" by collapsing the values
        // into a single string delimited by slashes. This just makes it convenient
        // for passing the array of parameters to this URL as a list of segments.
        $root = $this->formatRoot($this->formatScheme($secure));

        [$path, $query] = $this->extractQueryString($path);

        return $this->format(
            $root, '/'.trim($path.'/'.$tail, '/')
        ).$query;
    }
815300
public function getAuthURL(array $params = null):UriInterface{

		$params = array_merge(
			$params ?? [],
			['oauth_token' => $this->getRequestToken()->accessToken]
		);

		return $this->uriFactory->createUri(Psr7\merge_query($this->authURL, $params));
	}
1357030
public static function toAsset($url, $https = null)
    {
        if (static::valid($url) || static::valid('http:' . $url)) {
            return $url;
        }

        $app = Config::get('app');
        $root = ($app['asset_url'] != '') ? $app['asset_url'] : false;

        // shoot us through a different server or third-party content delivery network.
        if ($root) {
            return rtrim($root, '/') . '/' . ltrim($url, '/');
        }

        $url = static::to($url, $https, true);

        // we do not need to come through the front controller.
        if ($app['index'] !== '') {
            $url = str_replace($app['index'] . '/', '', $url);
        }

        return $url;
    }
1326786
protected function configAssetUrl($path, $secure = null)
    {
       static $assetUrl;

        // Remove this.
        $i = 'index.php';

        if (URL::isValidUrl($path)) return $path;

        // Finding asset url config.
        if (is_null($assetUrl))
        {
            $assetUrl = \Config::get('theme.assetUrl', '');
        }

        // Using asset url, if available.
        if ($assetUrl)
        {
            $base = rtrim($assetUrl, '/');

            // Asset URL without index.
            $basePath = str_contains($base, $i) ? str_replace('/'.$i, '', $base) : $base;
        }
        else
        {
            if (is_null($secure))
            {
                $scheme = Request::getScheme().'://';
            }
            else
            {
                $scheme = $secure ? 'https://' : 'http://';
            }

            // Get root URL.
            $root  = Request::root();
            $start = starts_with($root, 'http://') ? 'http://' : 'https://';
            $root  = preg_replace('~'.$start.'~', $scheme, $root, 1);

            // Asset URL without index.
            $basePath = str_contains($root, $i) ? str_replace('/'.$i, '', $root) : $root;
        }

        return $basePath.'/'.$path;
    }
417786
public function getUrl( $absolute = TRUE ){
		$url	= new ADT_URL( getEnv( 'REQUEST_URI' ) );
		if( $absolute ){
			$url->setScheme( getEnv( 'REQUEST_SCHEME' ) );
			$url->setHost( getEnv( 'HTTP_HOST' ) );
		}
		return $url;
	}
355837
public function setSecure(bool $isSecure) : Request
    {
        $isStandardPort = ($this->port === ($this->isSecure ? 443 : 80));

        if ($isStandardPort) {
            $this->port = $isSecure ? 443 : 80;
        }

        $this->isSecure = $isSecure;

        return $this;
    }
229689
public String getSecureUrl() {

        if (m_secureServer != null) {
            return m_secureServer.getUrl();
        } else {
            LOG.warn(Messages.get().getBundle().key(Messages.ERR_SECURESERVER_MISSING_1, toString()));
            return getUrl();
        }
    }