Returns TRUE if a given URI is valid.

@param  string $uri
@return boolean
551362
public static function check($uri)
  {
    try
    {
      $uri = new self(strval($uri));
    }
    catch(\Exception $e)
    {
      return FALSE;
    }

    return $uri->valid();
  }
338024
private function validateString(string $uri): void
    {
        if (!\is_string($uri)) {
            throw new InvalidArgumentException(sprintf('String required, %s given', \gettype($uri)));
        }
    }
1352147
public function checkUri($uris)
    {
        if (!$this->request) {
            return false;
        }

        foreach ((array)$uris as $uri) {
            if ($this->uri == $uri) {
                return true;
            }
        }

        return false;
    }
476991
public function delete(string $uri)
    {
        $request = $this->getRequest($uri)
            ->setMethod('DELETE');

        return $this->send($request);
    }
986525
public function checkRoute($uri)
    {
        foreach($this->strings as $expression)
        {
            // check if it matches the pattern
            $this->regex->setPattern($expression);
            if($this->regex->getMatches($uri))
            {
                $this->matchedUriParts = explode('/',$uri);
                return true;
            }
        }
        return false;
    }
944360
public function setUri( $uri )
    {
        $uri = (string) $uri;

        if ( empty( $uri ) )
        {
            $uri = '#';
        }
        else if ( ! preg_match( '(^(' . static::VALID_SCHEMES . '))', $uri ) )
        {
            if ( preg_match( '(^[a-z0-9-]+(\.[a-z0-9-]+)+(/.*)?$)', $uri ) )
            {
                $uri = static::DEFAULT_SCHEME . $uri;
            }
            else
            {
                $uri = '/' . ltrim( $uri, '/' );
            }
        }

        $this->uri = $uri;
        return $this;
    }
648130
private function validate($uri)
    {
        try {
            // set to false as default
            $validate = [];

            // check if there is the marker vor a special validation and or a / for complex routing
            if (strpos($uri, self::VALIDATION_PREFIX) === false && strpos($uri, $this->getDelimiter()) === false) {
                return false;
            }

            $parts = explode($this->_delimiter, $uri);
            for ($i = 0, $c = count($parts); $i < $c; $i++) {
                if (empty($parts[$i])) {
                    continue;
                } elseif ((strpos($parts[$i], self::VALIDATION_PREFIX)) === false) { // if there's no placeholder in use for a specific type
                    $this->urlPart[] = $parts[$i];
                    continue;
                }

                // this is an option to map "polymorph" [differnt types differnt classes / methods]
                $this->urlPart[] = $parts[$i];
                // position within the route to be validated
                $validate[]     = new Validator($parts[$i]);
                $this->validate = true;
            }
            unset($parts, $c, $i, $uri);
        } catch (RouteException $e) {
            throw $e;
        }

        return $validate;
    }
157910
public static function fromInvalidUri($uri)
    {
        return new self(sprintf('Expected data to be a valid URI object; received "%s"', is_object($uri) ? get_class($uri) : gettype($uri)));
    }
1096094
public function validateSocketUri($uri)
    {
        $uri = (string)$uri;
        if (!$uri) {
            throw new InvalidArgumentException('Invalid URI');
        }

        $scheme = parse_url($uri, PHP_URL_SCHEME);
        $scheme = $this->validateScheme($scheme);

        $host = parse_url($uri, PHP_URL_HOST);
        if (!$host) {
            throw new InvalidArgumentException("Invalid host");
        }

        $port = parse_url($uri, PHP_URL_PORT);
        if (!$port) {
            $port = $this->getPort($scheme);
        }

        return [$scheme, $host, $port];
    }
553993
public function validateVocabularyUri($uri)
    {
        $uri = trim($uri);

        // If the vocabulary URI is invalid
        if (!strlen($uri) || !filter_var($uri, FILTER_VALIDATE_URL)) {
            throw new RuntimeException(
                sprintf(RuntimeException::INVALID_VOCABULARY_URI_STR, $uri),
                RuntimeException::INVALID_VOCABULARY_URI
            );
        }

        return $uri;
    }
142307
public static function parse($uri) {
		$uri = static::to(static::detectPathFrom(parse_url($uri, PHP_URL_PATH)));

		$query = array ();
		parse_str(parse_url($uri, PHP_URL_QUERY), $query);
		foreach ($query as $k => $v) {
			$uri->param($k, $v);
		}
		return $uri;
	}
695305
protected function parse($uri)
    {
        $uri     = (string) $uri;
        $matches = array();

        preg_match('!' . self::getPattern() . '!', $uri, $matches);

        $scheme    = isset($matches[2]) ? $matches[2] : null;
        $authority = isset($matches[4]) ? $matches[4] : null;
        $path      = isset($matches[5]) ? $matches[5] : null;
        $query     = isset($matches[7]) ? $matches[7] : null;
        $fragment  = isset($matches[9]) ? $matches[9] : null;

        $this->scheme    = $scheme;
        $this->authority = $authority;
        $this->path      = $path;
        $this->query     = $query;
        $this->fragment  = $fragment;

        $this->parseAuthority($authority);
        $this->parseParameters($query);
    }
478420
public static function isValidAsCookieDomain($uri)
    {
        $domain = self::getDomain($uri);
        if (!empty($domain)) {
            if (preg_match("/^[a-z0-9\-]+(?:[a-z0-9\-]\.)+/iu", $domain) > 0) {
                $returnValue = true;
            } else {
                $returnValue = false;
            }
        } else {
            $returnValue = false;
        }

        return $returnValue;
    }
1172895
public function match($uri)
    {
        // Normalization of the url of the nagivator.
        if (preg_match('~(.*)/$~', $uri, $match)) {
            $uri = end($match);
        }

        // Normalization of the path defined by the programmer.
        if (preg_match('~(.*)/$~', $this->path, $match)) {
            $this->path = end($match);
        }

        // We go straight back to gain performance.
        if ($this->path === $uri) {
            return true;
        }

        // We check the length of the path defined by the programmer
        // with that of the current url in the user's browser.
        $path = implode('', preg_split('/(\/:[a-z0-9-_]+\?)/', $this->path));

        if (count(explode('/', $path)) != count(explode('/', $uri))) {
            if (count(explode('/', $this->path)) != count(explode('/', $uri))) {
                return false;
            }
        }

        // Copie de l'url
        $path = $uri;

        // In case the developer did not add of constraint on captured variables
        if (empty($this->with)) {
            $path = preg_replace('~:\w+(\?)?~', '([^\s]+)$1', $this->path);

            preg_match_all('~:([a-z-0-9_-]+?)\?~', $this->path, $this->keys);

            $this->keys = end($this->keys);

            return $this->checkRequestUri($path, $uri);
        }

        // In case the developer has added constraints
        // on the captured variables
        if (!preg_match_all('~:([\w]+)?~', $this->path, $match)) {
            return $this->checkRequestUri($path, $uri);
        }

        $tmp_path = $this->path;

        $this->keys = end($match);

        // Association of criteria personalized.
        foreach ($this->keys as $key) {
            if (array_key_exists($key, $this->with)) {
                $tmp_path = preg_replace('~:' . $key . '~', '(' . $this->with[$key] . ')', $tmp_path);
            }
        }

        // Clear the custom criteria association table.
        $this->with = [];

        // In the case where the different path one recovers, one recovers the one in $tmp_path
        if ($tmp_path != $this->path) {
            $path = $tmp_path;
        }

        // Url check and path PARSER
        return $this->checkRequestUri($path, $uri);
    }
1054576
public function checkIfExists($resourceUri) {
        //Break up the uri on the slashes
        $nodes = preg_split('/(\\\|\\/)/', $resourceUri, -1, PREG_SPLIT_NO_EMPTY);

        //foreach node
        $ptr = &$this->config;
        foreach($nodes as $node) {
            if (!isset($ptr[$node])) {
                return false;
            }
        }

        return true;
    }
1177560
public function isValid(): bool
    {
        $uris = [];
        foreach ($this->members as $member) {
            $uri = $member->uri;
            if ($uri) {
                if (isset($uris[$uri])) {
                    return false;
                } else {
                    $uris[$uri] = true;
                }
            }
        }
        return true;
    }
429854
public boolean isSkipURL(URI uri) {
		if (patternSkipURL == null || uri == null) {
			return false;
		}
		String sURI = uri.toString();
		return patternSkipURL.matcher(sURI).find();
	}