public function toString($to = self::TO_FRAGMENT, $schemaRelative = false)
	{
		if($to == static::TO_SCHEME)
		{
			return $this->scheme;
		}
		
		if($schemaRelative || empty($this->scheme))
		{
			$uri = empty($this->host) ? '' : '//';
		}
		else
		{
			$uri = empty($this->host) ? '' : ($this->scheme . '://');
		}
		
		if(isset($this->username) && !empty($this->host))
		{
			$uri .= $this->username;
				
			if(isset($this->password))
			{
				$uri .= ':' . $this->password;
			}
				
			$uri .= '@';
		}
		
		$uri .= $this->getHost(true) . '/';
		
		if($to == static::TO_HOST)
		{
			return $uri;
		}
		
		$uri .= $this->getPath(true);
		
		if($to == static::TO_PATH)
		{
			return $uri;
		}
		
		if(!empty($this->query))
		{
			$uri .= '?' . $this->getQueryString();
		}
		
		if($to == static::TO_QUERY)
		{
			return $uri;
		}
		
		if(!empty($this->fragment))
		{
			$uri .= '#' . $this->fragment;
		}
		
		return $uri;
	}