Resolves a given asset:// URI to a "normal" HTTP(S) URI for the addressed asset's resource.

@param string|Uri $uri
@return string|null If the URI cannot be resolved, null is returned
969296
public function resolveAssetUri(string $uri): ?string
    {
        $targetObject = $this->convertUriToObject($uri);
        if ($targetObject === null) {
            $this->systemLogger->info(sprintf('Could not resolve "%s" to an existing asset; The asset was probably deleted.', $uri), LogEnvironment::fromMethodName(__METHOD__));
            return null;
        }
        return $this->resourceManager->getPublicPersistentResourceUri($targetObject->getResource());
    }
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;
    }
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;
    }
521968
public function analyseURI($uri)
    {
        $uriElements = '/' . implode('/', $this->getURIElements());
        if ($uri == $uriElements) {
            $uri = '';
        } elseif (strpos($uri, $uriElements) === 0) {
            $uri = mb_substr($uri, mb_strlen($uriElements));
        }

        return $uri;
    }
1311594
private function getPathFromUri($uri)
    {
        $uriParser = new UriParser($uri);
        // Prepare uri
        $uriParser->encode();
        $uri = $uriParser->stripFragment();
        if (strpos($uri, '/') === 0) {
            // URI is already an path
            return $uri;
        }
        if (!$uriParser->validate()) {
            throw new \InvalidArgumentException('Invalid URI');
        }
        $path = (($path = parse_url($uri, PHP_URL_PATH)) === null) ? '/' : $path;
        $query = (($query = parse_url($uri, PHP_URL_QUERY)) === null) ? '' : '?' . $query;
        return $path . $query;
    }
446285
protected function resolveAssets(): ?string
    {
        $module = $this->getModuleInfo();
        if (!isset($module['assets'])) {
            return null;
        }
        $directory = $this->directory() . DIRECTORY_SEPARATOR . trim($module['assets'], DIRECTORY_SEPARATOR);
        return is_dir($directory) ? realpath($directory) : null;
    }
1331610
public function resolveRawAlias(string $uri): ?array
    {
        $this->normalizeUri($uri, $name);

        while (isset($this->aliases[$name])) {
            $alias = $this->aliases[$name];
            $name = $alias['alias'];
        }

        return $alias ?? null;
    }
517274
protected function resolution(UriInterface $referenceUri)
    {
        $key = $referenceUri->toString();
        if (array_key_exists($key, $this->resolutions)) {
            return $this->resolutions[$key];
        }

        return null;
    }
1142794
private function normalizeUri(string $uri): string
    {
        if (\stripos($uri, 'unix://') === 0) {
            return $uri;
        }

        try {
            $parts = Uri\parse($uri);
        } catch (\Exception $exception) {
            throw new SocketException("Could not parse URI", 0, $exception);
        }

        if ($parts['scheme'] === null) {
            throw new SocketException("Invalid URI for socket pool; no scheme given");
        }

        $port = $parts['port'] ?? 0;

        if ($parts['host'] === null || $port === 0) {
            throw new SocketException("Invalid URI for socket pool; missing host or port");
        }

        $scheme = \strtolower($parts['scheme']);
        $host = \strtolower($parts['host']);

        if (!\array_key_exists($scheme, self::ALLOWED_SCHEMES)) {
            throw new SocketException(\sprintf(
                "Invalid URI for socket pool; '%s' scheme not allowed - scheme must be one of %s",
                $scheme,
                \implode(', ', \array_keys(self::ALLOWED_SCHEMES))
            ));
        }

        if ($parts['query'] !== null || $parts['fragment'] !== null) {
            throw new SocketException("Invalid URI for socket pool; query or fragment components not allowed");
        }

        if ($parts['path'] !== '') {
            throw new SocketException("Invalid URI for socket pool; path component must be empty");
        }

        if ($parts['user'] !== null) {
            throw new SocketException("Invalid URI for socket pool; user component not allowed");
        }

        return $scheme . '://' . $host . ':' . $port;
    }
823926
private function createUri($uri)
    {
        if ($this->hasBaseUri() && (stripos($uri, $baseUri = (string) $this->getBaseUri()) === false)) {
            return $baseUri.$uri;
        }

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

        return $this->resolveRawAlias($uri)['alias'] ?? $uri;
    }
1355734
private function cleanupQuery(string $uri): string
    {
        if (false !== $pos = strpos($uri, '?')) {
            return substr($uri, 0, $pos);
        }

        return $uri;
    }
1235420
public function createUrlFromUri($uri)
    {
        $uri = ltrim($uri, '/');

        return empty($this->baseUrl)
            ? $this->app[\Illuminate\Contracts\Routing\UrlGenerator::class]->to($uri)
            : $this->baseUrl.$uri;
    }
1217686
public static function getAbsoluteUri(string $uri = null) : string
    {
        $uri = new self($uri);

        return $uri->get(false);
    }
528496
public function resolveWriter(ResourceUri $resource)
    {
        if (! array_key_exists($resource->getProtocol(), $this->protocolWriterIndexes)) {
            throw new \RuntimeException('Unsupported protocol: ' . $resource->getProtocol() . '( ' . $resource  . ')');
        }

        /** @var int $index */
        $index = $this->protocolWriterIndexes[$resource->getProtocol()];

        return $this->writers[$index];
    }
204481
public function uri_to_qname($uri) {
        if (preg_match('~^(.*[\/\#])([a-z0-9\-\_\:]+)$~i', $uri, $m)) {
            $ns = $m[1];
            $localname = $m[2];
            $prefix = $this->get_prefix($ns);
            if ( $prefix != null && $prefix !== FALSE) {
                return $prefix . ':' . $localname;
            }
        }
        return null;
    }
1046678
private function cleanupAnchor(string $uri): string
    {
        if (false !== $pos = strpos($uri, '#')) {
            return substr($uri, 0, $pos);
        }

        return $uri;
    }