Tell whether the URI represents an absolute URI.

@param Psr7UriInterface|UriInterface $uri
171118
public static function isAbsolute($uri): bool
    {
        $null = $uri instanceof Psr7UriInterface ? '' : null;

        return $null !== self::filterUri($uri)->getScheme();
    }
1256556
protected static boolean isRelativeUri(URI uri) {
        if (uri.isAbsolute())
            return false;
        String path = uri.normalize().getPath();
        if (path.length() == 0 /* isEmpty() is mustang API */)
            return false;
        if (!path.equals(uri.getPath())) // implicitly checks for embedded . and ..
            return false;
        if (path.startsWith("/") || path.startsWith("./") || path.startsWith("../"))
            return false;
        return true;
    }
354463
public function setUri($uri)
    {
        if (in_array($uri, $this->uris, TRUE)) {
            throw new \Exception('Redirecting loop detected');
        }
        $this->uris[] = $uri;
        return $this;
    }
18501
private function validate(UriInterface $uri): void
    {
        $scheme = $uri->getScheme();
        if (null === $scheme && '' === $uri->getHost()) {
            throw new SyntaxError(sprintf('an URI without scheme can not contains a empty host string according to PSR-7: %s', (string) $uri));
        }

        $port = $uri->getPort();
        if (null !== $port && ($port < 0 || $port > 65535)) {
            throw new SyntaxError(sprintf('The URI port is outside the established TCP and UDP port ranges: %s', (string) $uri->getPort()));
        }
    }
1356525
public function setCurrentURI($uri) {
        if(is_string($uri) && !empty(trim($uri))){
            $this->currentURI = $uri;
            $this->currentArray = Levels::getCurrent($this->navigation, $this->currentURI);
        }
        else{
            throw new InvalidArgumentException(
                '$uri must be a valid string when seting the current URI'
            );
        }
        return $this;
    }
1247015
public static function validateURI($uri) {
        if(!empty(trim($uri))){
            return filter_var(trim($uri), FILTER_VALIDATE_URL);
        }
        return false;
    }
853852
public static function createFromPsr7(Psr7UriInterface $uri): self
    {
        $components = [
            'scheme' => null,
            'user' => null,
            'pass' => null,
            'host' => null,
            'port' => $uri->getPort(),
            'path' => $uri->getPath(),
            'query' => null,
            'fragment' => null,
        ];

        $scheme = $uri->getScheme();
        if ('' !== $scheme) {
            $components['scheme'] = $scheme;
        }

        $fragment = $uri->getFragment();
        if ('' !== $fragment) {
            $components['fragment'] = $fragment;
        }

        $query = $uri->getQuery();
        if ('' !== $query) {
            $components['query'] = $query;
        }

        $host = $uri->getHost();
        if ('' !== $host) {
            $components['host'] = $host;
        }

        $user_info = $uri->getUserInfo();
        if (null !== $user_info) {
            [$components['user'], $components['pass']] = explode(':', $user_info, 2) + [1 => null];
        }

        return Uri::createFromComponents($components);
    }
1294863
private function setUri($uri)
    {
        $this->uri = $uri;

        preg_match_all('/({[^}]+})/', $this->uri, $matches);
        $this->params = $matches[0];

        return $this;
    }
1287898
public static boolean isAbsolute(final URI uri) {
        final String p = uri.getPath();
        return p != null && p.startsWith(URI_SEPARATOR);
    }
500425
public static function isAbsolutePathReference(UriInterface $uri)
    {
        $uriPath = $uri->getPath();
        return $uri->getScheme() === ''
            && $uri->getAuthority() === ''
            && isset($uriPath[0])
            && $uriPath[0] === '/';
    }
1272008
public static function releaseUri($uri)
    {
        if ($uri instanceof StreamInterface) {
            $uri = 'spiral://' . spl_object_hash($uri);
        }

        unset(self::$uris[$uri]);
    }
823926
private function createUri($uri)
    {
        if ($this->hasBaseUri() && (stripos($uri, $baseUri = (string) $this->getBaseUri()) === false)) {
            return $baseUri.$uri;
        }

        return $uri;
    }
944282
public function resolveAgainst(Uri $uri)
    {
        if ($this->isAbsolute()) {
            throw new \LogicException(
                'Cannot resolve against another URI: URI is already absolute'
            );
        }

        if (!$uri->isAbsolute()) {
            throw new \LogicException(
                'Cannot resolve against another URI: reference URI is not absolute'
            );
        }

        $resolved = $this->buildResolvedUriAgainst($uri);
        $this->buildFromRawUri($resolved);

        return $resolved;
    }
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'] : '');
    }
788748
public static function isValid(string $uri): bool {
        try {
            new self($uri);
        } catch (InvalidUriException $e) {
            return false;
        }

        return true;
    }
731793
public static function isNetworkPath($uri): bool
    {
        $uri = self::filterUri($uri);
        $null = $uri instanceof Psr7UriInterface ? '' : null;

        return $null === $uri->getScheme() && $null !== $uri->getAuthority();
    }
732936
protected function getAbsoluteUri($uri)
    {
        // already absolute?
        if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) {
            return $uri;
        }

        if (!$this->history->isEmpty()) {
            $currentUri = $this->history->current()->getUri();
        } else {
            $currentUri = sprintf('http%s://%s/',
                isset($this->server['HTTPS']) ? 's' : '',
                isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : 'localhost'
            );
        }

        // protocol relative URL
        if (0 === strpos($uri, '//')) {
            return parse_url($currentUri, PHP_URL_SCHEME).':'.$uri;
        }

        // anchor or query string parameters?
        if (!$uri || '#' == $uri[0] || '?' == $uri[0]) {
            return preg_replace('/[#?].*?$/', '', $currentUri).$uri;
        }

        if ('/' !== $uri[0]) {
            $path = parse_url($currentUri, PHP_URL_PATH);

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

            $uri = $path.$uri;
        }

        return preg_replace('#^(.*?//[^/]+)\/.*$#', '$1', $currentUri).$uri;
    }