生成标准化uri
@param  string $path
@return string
193719
public static function getCanonicalURIPath($path)
    {
        //空路径设置为'/'
        if (empty($path)) {
            return '/';
        } else {
            //所有的uri必须以'/'开头
            if ($path[0] == '/') {
                return AipHttpUtil::urlEncodeExceptSlash($path);
            } else {
                return '/' . AipHttpUtil::urlEncodeExceptSlash($path);
            }
        }
    }
872989
public function create(RoutePath $path, array $attributes = []): string
    {
        $uri = new PathUri($path, $attributes);

        return (string)$uri;
    }
718182
protected function getApiUrl($path) {
		// remove extra / at the beginning
		$path = ltrim($path, '/');

		// prepend protocol if not passed
		$protocol = '';
		if(strpos($this->domain, 'http://') !== 0 && strpos($this->domain, 'https://') !== 0) {
			$protocol = 'https://';
		}

		// assemble final url
		return $protocol . $this->domain . '/api/' . self::API_VERSION . '/' . $path;
	}
505596
public static function encodePath($path)
    {
        if (mb_strpos($path, '/') !== false) {
            $path = explode('/', $path);
            $path = array_map('rawurlencode', $path);
            $newPath = implode('/', $path);
        } else {
            if (is_null($path)) {
                $newPath = null;
            } else {
                $newPath = rawurlencode($path);
            }
        }
        $path = str_replace('%21', '!', $newPath);

        return $path;
    }
26871
private function formatPath(string $path): string
    {
        $path = $this->formatDataPath($path);

        static $pattern = '/(?:[^'.self::REGEXP_CHARS_UNRESERVED.self::REGEXP_CHARS_SUBDELIM.'%:@\/}{]++\|%(?![A-Fa-f0-9]{2}))/';

        $path = (string) preg_replace_callback($pattern, [Uri::class, 'urlEncodeMatch'], $path);

        return $this->formatFilePath($path);
    }
1175931
final protected function makePathAbsolute($path): string
    {
        $baseUrl = rtrim($this->baseUrl, '/') . '/';

        return 0 !== strpos($path, 'http') ? $baseUrl . ltrim($path, '/') : $path;
    }
693122
public function getUrl($path)
    {
        $uri = rtrim($this->storageApiUri, '/');
        $path = $this->applyPathPrefix($path);

        // Only prepend bucket name if no custom storage uri specified
        // Default: "https://storage.googleapis.com/{my_bucket}/{path_prefix}"
        // Custom: "https://example.com/{path_prefix}"
        if ($this->getStorageApiUri() === self::STORAGE_API_URI_DEFAULT) {
            $path = $this->bucket->name() . '/' . $path;
        }

        return $uri . '/' . $path;
    }
87538
static public function urlToPath($path)
    {
        $path = parse_url($path);
        return $path === null ? null : str_replace('/', DIRECTORY_SEPARATOR, $path['path']);
    }
971371
private function getUri($path, $params)
    {
        $uri = '/';
        if (strlen($path) > 0) {
            $uri = $path;
        }

        if (strlen($params) > 0) {
            $uri .= '?' . $params;
        }

        return $uri;
    }
361124
public function asset_url($path)
	{
		$url = $this->asset_path($path);

		if (filter_var($url, FILTER_VALIDATE_URL) === false)
		{
			$url = \Uri::create($url);
		}

		return $url;
	}
657118
public function getUrlFromPath($path)
    {
        $path = ltrim($path, '/');

        $host = 'https://'.($this->use_sandbox ? 'sandbox-' : '').'api.uber.com';

        return $host.($this->version ? '/'.$this->version : '').'/'.$path;
    }
1357495
private function _buildServerURI($path = 'challenge')
	{
	  	// Scheme
		$uri  = ( TRUE === $this->_ssl ) ? 'https://' : 'http://';
	  	// Host
		$uri .= self::RECAPTCHA_API_SERVER;
	  	// Path
		$uri .= ($path !== 'challenge') ? 'noscript' : $path;
	  	// Query
		$uri .= '?k=' . $this->_publicKey;
		$uri .= ($this->_error) ? '&error=' . $this->_error : NULL;
		$uri .= ( isset($this->_recaptchaOptions['lang']) ) ? '&hl=' . $this->_recaptchaOptions['lang'] : '&hl=' .$this->clientLang();

		return $uri;
	}
1088553
protected function marshalPath($path): string
    {
        if ( null === $path ) {
            $path = '/';
        }

        if ( ! is_string($path) ) {
            throw new UriException(
                'Path must be a string or null'
            );
        }

        return preg_replace_callback(
            '/(?:[^'.self::$unreservedCharacters.self::$subDelimitedCharacters.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
            function($match) {
                return rawurlencode($match[0]);
            },
            $path
        );
    }
644839
protected function makePath($path)
    {
        return $this->context->directory ? $this->context->directory.'/'.$path : $path;
    }
1025990
public function makeUrl($path) {
		if ($path{0} == '/') $path = substr($path, 1);
		$dsn = explode('/', $path, 2);
		$size = count($dsn);
		
		$controller = $dsn[0];
		$action = '';
		if ($size > 0) {
			$action = $dsn[1];
		}
		
		$param_array = array();
		if ($size > 1) {
			for ($i = 2; $i <= $size; $i+=2) {
				$param_array[$names[$size]] = isset($names[$size + 1]) ? $names[$size + 1] : '';
			}
		}
		
		$url = $controller;
		if ($action != '') {
			$url.= '/' . $action;
		}
		
	}
760816
protected function makeSurePathIsAbsolute($path): string
    {
        $site_url = rtrim($this->getParameter('site_url'), '/') . '/';

        if (0 !== strpos($path, 'http')) {
            return $site_url . ltrim($path, '/');
        } else {
            return $path;
        }
    }
822867
public function url($path = '')
    {
        $path = trim($path, '/');
        if ($this->enabled) {
            $hash = ($this->hash) ? trim($this->hash, '/') . '/' : '';
            return $this->cdn . $this->prefix . $hash . $path;
        } else {
            return $this->cdn . $path;
        }

    }