resolveAlias

@param   string $uri

@return  string
976168
public function resolveAlias($uri)
    {
        $this->normalizeUri($uri, $name);

        return $this->resolveRawAlias($uri)['alias'] ?? $uri;
    }
1021258
public function resolveRelativeUri(string $uri): string
    {
        $parts = parse_url($uri);
        if (isset($parts['scheme'])) {
            // absolute URL
            return $uri;
        }

        $baseUri = $this->getUri();
        if (strncmp($baseUri, 'file://', 7) === 0) {
            if (isset($parts['path'][0]) && $parts['path'][0] === '/') {
                // absolute path
                return 'file://' . $parts['path'];
            }
            if (isset($parts['path'])) {
                // relative path
                return dirname($baseUri) . '/' . $parts['path'];
            }

            throw new UnresolvableReferenceException("Invalid URI: '$uri'");
        }

        $baseParts = parse_url($baseUri);
        $absoluteUri = implode('', [
            $baseParts['scheme'],
            '://',
            isset($baseParts['username']) ? $baseParts['username'] . (
                isset($baseParts['password']) ? ':' . $baseParts['password'] : ''
            ) . '@' : '',
            $baseParts['host'] ?? '',
            isset($baseParts['port']) ? ':' . $baseParts['port'] : '',
        ]);
        if (isset($parts['path'][0]) && $parts['path'][0] === '/') {
            $absoluteUri .= $parts['path'];
        } elseif (isset($parts['path'])) {
            $absoluteUri .= rtrim(dirname($baseParts['path'] ?? ''), '/') . '/' . $parts['path'];
        }
        return $absoluteUri
            . (isset($parts['query']) ? '?' . $parts['query'] : '')
            . (isset($parts['fragment']) ? '#' . $parts['fragment'] : '');
    }
678260
protected function _uri_string($uri)
	{
		if ($this->item('enable_query_strings') == FALSE)
		{
			if (is_array($uri))
			{
				$uri = implode('/', $uri);
			}
			$uri = trim($uri, '/');
		}
		else
		{
			if (is_array($uri))
			{
				$i = 0;
				$str = '';
				foreach ($uri as $key => $val)
				{
					$prefix = ($i == 0) ? '' : '&';
					$str .= $prefix.$key.'='.$val;
					$i++;
				}
				$uri = $str;
			}
		}
	    return $uri;
	}
1214990
private function toAbsoluteURI($uri)
    {
        list($pathBase, $scheme, $prePath) = $this->getPathInfo($this->configuration->getOriginalURL());

        // If this is already an absolute URI, return it.
        if (preg_match('/^[a-zA-Z][a-zA-Z0-9\+\-\.]*:/', $uri)) {
            return $uri;
        }

        // Scheme-rooted relative URI.
        if (substr($uri, 0, 2) === '//') {
            return $scheme . '://' . substr($uri, 2);
        }

        // Prepath-rooted relative URI.
        if (substr($uri, 0, 1) === '/') {
            return $prePath . $uri;
        }

        // Dotslash relative URI.
        if (strpos($uri, './') === 0) {
            return $pathBase . substr($uri, 2);
        }
        // Ignore hash URIs:
        if (substr($uri, 0, 1) === '#') {
            return $uri;
        }

        // Standard relative URI; add entire path. pathBase already includes a
        // trailing "/".
        return $pathBase . $uri;
    }
1142728
public function analyseURI($uri)
    {
        if (($siteaccessPart = "/$this->key") === $uri) {
            return '/';
        }

        if (mb_strpos($uri, $siteaccessPart) === 0) {
            return mb_substr($uri, mb_strlen($siteaccessPart));
        }

        return $uri;
    }
1369646
public function toBrandParentCdn(string $uri = ''): string
    {
        return $this->App->Parent ? $this->App->Parent->Utils->§BrandUrl->toBrandCdn($uri) : $this->toBrandCdn($uri);
    }
387852
public static function datapathToAscii($uri)
    {
        return $uri->withPath((string) (new DataPath(self::filterUri($uri)->getPath()))->toAscii());
    }
1374396
static public function escapeUri(string $uri): string {
        self::initSerializer();
        return self::$serializer->serialiseValue(new Resource($uri));
    }
745277
private function uriToFile($uri)
    {
        $uri = str_replace($this->baseUri, '', $uri);
        $schemaDir = realpath("{$this->kernelDir}/../vendor/claroline/json-quiz/format");

        return $schemaDir.'/'.$uri;
    }
883754
private static function normalize($uri)
    {
        $uri = self::filterUri($uri);
        $null = $uri instanceof Psr7UriInterface ? '' : null;

        $path = $uri->getPath();
        if ('/' === ($path[0] ?? '') || '' !== $uri->getScheme().$uri->getAuthority()) {
            $path = UriResolver::resolve($uri, $uri->withPath('')->withQuery($null))->getPath();
        }

        $query = $uri->getQuery();
        $fragment = $uri->getFragment();
        $fragmentOrig = $fragment;
        $pairs = null === $query ? [] : explode('&', $query);
        sort($pairs, SORT_REGULAR);

        $replace = static function (array $matches): string {
            return rawurldecode($matches[0]);
        };

        $retval = preg_replace_callback(self::REGEXP_ENCODED_CHARS, $replace, [$path, implode('&', $pairs), $fragment]);
        if (null !== $retval) {
            [$path, $query, $fragment] = $retval + ['', $null, $null];
        }

        if ($null !== $uri->getAuthority() && '' === $path) {
            $path = '/';
        }

        return $uri
            ->withHost(Uri::createFromComponents(['host' => $uri->getHost()])->getHost())
            ->withPath($path)
            ->withQuery([] === $pairs ? $null : $query)
            ->withFragment($null === $fragmentOrig ? $fragmentOrig : $fragment);
    }
910112
private function normalizarUri($uri)
    {
        // Excluimos los queries del URI
        if (($temp = strpos($uri, '?')) !== false) {
            $uri = substr($uri, 0, $temp);
        }

        // Agregamos / al inicio en caso necesario
        if (strpos($uri, '/') !== 0) {
            $uri = '/' . $uri;
        }

        // Quitamos / al final del URI
        if ($uri !== '/' && substr($uri, -1, 1) == '/') {
            $uri = substr($uri, 0, -1);
        }

        return $uri;
    }
1040910
public function standardizeUri(string $uri): string {
        if ($uri == '') {
            throw new BadMethodCallException('URI is empty');
        }
        if (substr($uri, 0, 1) === '/') {
            $uri = substr($uri, 1);
        }
        $uri = preg_replace('|^https?://[^/]+/rest/(tx:[-0-9a-zA-Z]+/)?|', '', $uri);
        $uri = $this->apiUrl . '/' . $uri;
        return $uri;
    }
131270
protected function pathFromUri(HttpUriInterface $uri)
    {
        $path = $uri->getPath();
        if (null === $path) {
            $path = '';
        }

        return $path;
    }
79001
function requestURI( $uri )
    {
        $parsed = parse_url( $uri );

        $return = '';
        if ( isset( $parsed['user'] ) )
        {
            $return .= $parsed['user'] . '@' . $parsed['pass'];
        }
        $return .= rtrim( $parsed['path'], '/' ) . '/' . $this->Name;

        if ( isset( $parsed['query'] ) )
        {
            $return  .= '?' . $parsed['query'];
        }
        if ( isset( $parsed['fragment'] ) )
        {
            $return .= '#' . $parsed['fragment'];
        }

        return $return;
    }
629907
protected function removeAdditionalUriData($uri)
    {
        if (strpos($uri, '?') !== false) {
            return substr($uri, 0, strpos($uri, '?'));
        } else if (strpos($uri, '#') !== false) {
            return substr($uri, 0, strpos($uri, '#'));
        }
        
        return $uri;
    }
1069341
public function setUri($uri=''){
    $this->uri = $uri;
    // 解析uri
    $uriObj = DdvUrl::parse($uri);
    empty($uriObj['host']) || $this->setHost($uriObj['host']);
    empty($uriObj['path']) || $this->setPath($uriObj['path']);
    empty($uriObj['query']) || $this->setQuery($uriObj['query']);
    empty($uriObj['port']) || $this->setPort($uriObj['port']);
    empty($uriObj['fragment']) || $this->setFragment($uriObj['fragment']);
    return $this;
  }
1124028
protected function parseUri($uri)
    {
        if ($uri && stripos($uri, 'unix://') === 0) {
            // parse_url() doesn't like "unix:///foo", but parses "unix:/foo" fine.
            $uri = str_ireplace('unix://', 'unix:', $uri);
        } elseif ($uri && $uri[0] !== '/' && !preg_match('#^\w+://?.+#', $uri)) {
            // If no scheme given and path exists and isn't absolute, assume tcp scheme is wanted.
            // This allows both "127.0.0.1" and "/foo.sock" to work without specifying scheme.
            // If non absolute path is wanted, specify the scheme: "unix://foo.sock"
            $uri = 'tcp://' . $uri;
        }

        $parsed = new Uri($uri);

        return $parsed;
    }