Create UrlBuilder instance.
@param  string      $baseUrl URL prefixed to generated URL.
@param  string|null $signKey Secret key used to secure URLs.
@return UrlBuilder  The UrlBuilder instance.
771338
public static function create($baseUrl, $signKey = null)
    {
        $httpSignature = null;

        if (!is_null($signKey)) {
            $httpSignature = SignatureFactory::create($signKey);
        }

        return new UrlBuilder($baseUrl, $httpSignature);
    }
183519
protected function assembleUrl($baseUrl, array $query = [], $fragment = '') {
			if ($query)
				$baseUrl .= '?' . http_build_query($query);

			if ($fragment)
				$baseUrl .= '#' . $fragment;

			return $baseUrl;
		}
819130
public static function create_standard_issuer($type, $baseurl = false) {
        require_capability('moodle/site:config', context_system::instance());
        if ($type == 'google') {
            $issuer = self::init_google();
            $issuer->create();
            return self::create_endpoints_for_google($issuer);
        } else if ($type == 'microsoft') {
            $issuer = self::init_microsoft();
            $issuer->create();
            return self::create_endpoints_for_microsoft($issuer);
        } else if ($type == 'facebook') {
            $issuer = self::init_facebook();
            $issuer->create();
            return self::create_endpoints_for_facebook($issuer);
        } else if ($type == 'nextcloud') {
            if (!$baseurl) {
                throw new moodle_exception('Nextcloud service type requires the baseurl parameter.');
            }
            $issuer = self::init_nextcloud();
            $issuer->set('baseurl', $baseurl);
            $issuer->create();
            return self::create_endpoints_for_nextcloud($issuer);
        } else {
            throw new moodle_exception('OAuth 2 service type not recognised: ' . $type);
        }
    }
834316
public function signatureA($url, $key = null, $timestamp = null, $random = null, $signName = 'sign')
    {
        $key = $key ?: $this->getConfig()->get('cdn_key');
        $timestamp = $timestamp ?: time();
        $random = $random ?: sha1(uniqid('', true));

        $parsed = parse_url($url);
        $hash = md5(sprintf('%s-%s-%s-%s-%s', $parsed['path'], $timestamp, $random, 0, $key));
        $signature = sprintf('%s-%s-%s-%s', $timestamp, $random, 0, $hash);
        $query = http_build_query([$signName => $signature]);
        $separator = empty($parsed['query']) ? '?' : '&';

        return $url.$separator.$query;
    }
954319
public function makeAbsolute($baseurl = null) {
        if (!$baseurl) return $this;
        if (!$baseurl instanceof Url) $baseurl = new static($baseurl);
        if ($this->is_url() && ($this->is_relative() || $this->is_host_relative() || $this->is_protocol_relative()) && $baseurl instanceof Url) {
            if (!$this->host) $this->host = $baseurl->getHost();
            $this->scheme = $baseurl->getScheme();
            $this->user = $baseurl->getUser();
            $this->pass = $baseurl->getPass();
            $this->port = $baseurl->getPort();
            $this->path = static::buildAbsolutePath($this->path, $baseurl->getPath());
        }
        return $this;
    }
415984
protected function createAuthCode($userkey, $applicationkey) {
        $payload = $userkey . "@" . strtolower($this->serverhostname) . "|" . strtolower($applicationkey);
        return strtoupper(sha1($payload));
    }
1238787
public static function createInstallationClient($url, CertificateStorage $certificateStorage)
    {
        $handlerStack = HandlerStack::create();
        $handlerStack->push(
            Middleware::mapRequest(new RequestIdMiddleware())
        );
        $handlerStack->push(
            Middleware::mapRequest(new RequestSignatureMiddleware($certificateStorage->load(CertificateType::PRIVATE_KEY())))
        );

        return self::createBaseClient((string)$url, $handlerStack);
    }
1275849
protected function buildUrl(string $pathName, array $params = []): string
    {
        $uri = new BasicUri($this->baseUrl.$this->token.$pathName);
        foreach ($params as $name => $value) {
            if (is_bool($value)) {
                $value = (int)$value;
            }
            $uri = $uri->withQueryValue($name, $value);
        }

        return (string) $uri;
    }
639272
public function createAbsoluteUrl($uri, $query_params = [], $ssl = false, $port = 80, $request = null)
    {
        if ($this->isSingle()) {
            return UrlManager::createAbsoluteUrl($uri, $query_params, $ssl, $port, $request);
        }
        return '';
    }
576064
def _generate_signature(self, base_url, private_key):
        
        url = urlparse.urlparse(base_url)
        url_to_sign = url.path + '?' + url.query
        decoded_key = base64.urlsafe_b64decode(private_key)
        signature = hmac.new(decoded_key, url_to_sign, hashlib.sha1)
        return base64.urlsafe_b64encode(signature.digest())
50952
public function combineURL($baseURL,$keysArr){
        $combined = $baseURL."?";
        $valueArr = array();

        foreach($keysArr as $key => $val){
            $valueArr[] = "$key=$val";
        }

        $keyStr = implode("&",$valueArr);
        $combined .= ($keyStr);
        
        return $combined;
    }
732556
protected function makeAbsoluteUrl($relativeUrl, $baseUrl = null)
    {
        $baseUrl = $baseUrl ?: $this->baseUrl;
        if (empty($baseUrl)) {
            throw new \RuntimeException('No base URL');
        }
        $base = \GuzzleHttp\Psr7\uri_for($baseUrl);

        return $base->withPath($relativeUrl)->__toString();
    }
1043628
public URL signUrlWithSigner(String bucketName, String blobName, String keyPath)
      throws IOException {
    // [START signUrlWithSigner]
    URL signedUrl =
        storage.signUrl(
            BlobInfo.newBuilder(bucketName, blobName).build(),
            14,
            TimeUnit.DAYS,
            SignUrlOption.signWith(
                ServiceAccountCredentials.fromStream(new FileInputStream(keyPath))));
    // [END signUrlWithSigner]
    return signedUrl;
  }
1110510
public static function create($baseUrl, self $apiClient = null)
    {
        return $apiClient === null ? new self(new Client(), $baseUrl) : $apiClient;
    }
32072
public function createNew(
        string $providerName,
        string $credentialPubKey,
        string $accessToken,
        string $tokenSecret = '',
        string $signupHash = ''
    ) : array {

        $array = [
            'provider'     => $providerName,
            'access_token' => $accessToken,
            'credential'   => $credentialPubKey
        ];

        if (! empty($tokenSecret)) {
            $array['token_secret'] = $tokenSecret;
        }

        if (! empty($signupHash)) {
            $array['signup_hash'] = $signupHash;
        }

        return $this->sendPost(
            '/sso',
            [],
            $array
        );
    }
950082
protected function createAbsoluteUrl(UriInterface $basePath, $targetPath)
    {
        $targetPath = strval($targetPath);
        if ($targetPath === '') {
            return $basePath->withPath('');
        } else {
            if ($this->isRelativeUri($targetPath)) {
                $parts = parse_url($targetPath);
                $path  = isset($parts['path']) ? ltrim($parts['path'], '/') : '';
                $query = isset($parts['query']) ? $parts['query'] : '';
                $hash  = isset($parts['fragment']) ? $parts['fragment'] : '';
                $targetPath = $basePath->withPath($path)->withQuery($query)->withFragment($hash);
            }
        }

        return $targetPath;
    }
1198223
public static function appendParamsUrl($baseUrl, $params)
    {
        foreach ($params as $key => &$value) {
            if (is_bool($value)) {
                $value = self::getBoolString($value);
            }
        }

        return $baseUrl . '?' . http_build_query($params);
    }