URL-encodes collection path.

@param string $path

@return string $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;
    }
801492
public function getUrl($path)
    {
        $url = '';
        $share = $this->dropbox->createShareableLink($this->pathRoot.$path);
        if ($share)
            $url = str_replace('www.dropbox.com' ,  'dl.dropboxusercontent.com', $share);
        
        return $url;
    }
1176328
public function getUrlForPath($path)
    {
        $fragments = parse_url($path);

        if (!isset($fragments['path']))
            throw new UrlException("URL is not a valid path: '$path'");

        $newUrl = clone $this;
        $newUrl->_fragments['path'] = $fragments['path'];

        // overwrite RHS components
        foreach (array('query', 'fragment') as $component) {
            if (isset($fragments[$component]))
                $newUrl->_fragments[$component] = $fragments[$component];
            elseif (isset($newUrl->_fragments[$component]))
                unset($newUrl->_fragments[$component]);
        }

        // store the new URL internally
        $newUrl->_inputString = $newUrl->__toString();

        return $newUrl;
    }
249204
protected static function mapPath(string $path) : string
    {
        if (getenv('APP_MAPPING')) {
            $path = str_replace(AbstractApp::getAppRoot(), getenv('APP_MAPPING'), $path);
        }

        return $path;
    }
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
        );
    }
1314073
public static function data_uri(string $path) {
		ref\cast::string($path, true);
		ref\file::path($path, true);

		if ((false !== $path) && @\is_file($path)) {
			$content = \base64_encode(@\file_get_contents($path));
			$finfo = mime::finfo($path);

			return "data:{$finfo['mime']};base64,{$content}";
		}

		return false;
	}
799758
private function asPath($path)
    {
        $expr = explode(";", $path);
        $fullPath = "$";
        for ($i = 1, $n = count($expr); $i < $n; $i++) {
            $fullPath .= preg_match("/^[0-9*]+$/", $expr[$i]) ? ("[" . $expr[$i] . "]") : ("['" . $expr[$i] . "']");
        }

        return $fullPath;
    }
124207
public function getUrl($path) {
        if (strpos($path, '://') !== false) {
            return $path;
        }
        $url = 'https://api.mch.weixin.qq.com/';
        if ($this->get('debug_mode') === true) {
            $url .= 'sandboxnew/';
        }
        return $url. trim($path, '/');
    }
702172
private function _filterPath($path)
    {
        $path = preg_replace_callback(
            '/(?:[^' . self::UNRESERVED_CHARACTERS . self::SUB_DELIMS_CHARACTERS . '%:@\/]+|%(?![A-Fa-f0-9]{2}))/',
            [$this, '_rawUrlEncode'],
            $path
        );

        if ($path && $path[0] === '/') {
            $path = '/' . ltrim($path, '/');
        }

        return $path;
    }
1049283
private function prepareUrl($path)
    {
        $bits = parse_url($path);

        $path = isset($bits['path']) && $bits['path'] ? $bits['path'] : '/';

        if (substr($path, 0, 1) !== '/') {
            $path = '/' . $path;
        }

        $query = isset($bits['query']) && $bits['query'] ? '?' . $bits['query'] : '';

        return $this->getUrl() . '/api/v' . $this->getApiVersion() . $path . $query;
    }
1245910
public function determineRequestUriFromPath($path)
    {
        if ($path instanceof Url) {
            $uri = $path;
        } elseif (stripos($path, 'http://') === 0 || stripos($path, 'https://') === 0) {
            $uri = new Url($path);
        } else {
            $path = (string) $path;
            $uri = $this->getBaseApiUri();

            if (false !== strpos($path, '?')) {
                $parts = explode('?', $path, 2);
                $path = $parts[ 0 ];
                $query = $parts[ 1 ];
                $uri->setQuery($query);
            }

            // Add path
            $uri->getPath()->append("$path");

            // Clean up double slashes
            $uri->setPath(array_filter($uri->getPath()->toArray()));
        }

        return $uri;
    }
642781
private function fileRelativePath($path)
    {
        $path = $this->fileWebpath($path);
        // @todo This wont work for files not located on the current server...
        $path = str_replace_first(env('APP_URL'), '', $path);
        $path = str_replace(' ', '%20', $path);

        return $path;
    }
387895
protected function buildUrl($path)
    {
        $path = str_replace('%2F', '/', $path);
        $path = str_replace(' ', '%20', $path);

        return rtrim($this->base, '/') . '/' . $path;
    }
87538
static public function urlToPath($path)
    {
        $path = parse_url($path);
        return $path === null ? null : str_replace('/', DIRECTORY_SEPARATOR, $path['path']);
    }
1290156
protected function filterPath($path)
    {
        $pathStr    = $this->filterString($path);
        $pathDecode = rawurldecode($pathStr);

        $dataPath = array_map(
            function ($value) {
                return rawurlencode($value);
            },
            explode('/', $pathDecode)
        );

        return implode('/', $dataPath);
    }
416517
protected function encodePath($path)
	{
		$a = explode('/', $path);
		for ($i=0; $i<count($a); $i++) {
			$a[$i] = rawurlencode($a[$i]);
		}
		return implode('/', $a);
	}
1075945
protected function formatPath($path)
    {
        $path = trim($path, '/') . '/';
        if (strlen($path) > 1) {
            $path = '/' . $path;
        }

        return $path;
    }