protected function init()
    {
        $uri = $this->token;
        // check scheme
        if (($pos = strpos($uri, ':')) !== false) {
            $this->scheme = substr($uri, 0, $pos);
            $rest = substr($uri, $pos + 1);
        } else {
            $rest = $uri;
        }
        // check fragment
        if (($pos = strrpos($rest, '#')) !== false) {
            $this->fragment = substr($rest, $pos + 1);
            $rest = substr($rest, 0, $pos);
        }
        $this->schemeSpecificPart = $rest;

        // A hierarchical URI
        if (($this->isAbsolute() && $this->schemeSpecificPart{0} == '/') || !$this->isAbsolute()) {
            $parts = array();
            if (preg_match('/^(\/\/([^\/]*))?(\/?[^\?]+)?(\?(.*?))?$/S', $this->schemeSpecificPart, $parts)) {
                if (isset($parts[2])) {
                    $this->setAuthority($parts[2]);
                }
                if (isset($parts[3]) && $parts[3]) {
                    $this->path = $parts[3];
                }
                if (isset($parts[5]) && $parts[5]) {
                    $this->query = $parts[5];
                }
            } else {
                throw new \DomainException("Hierarchical URI scheme-specific part syntax error");
            }
        }

        $this->hash = null;
    }