public function setQuery(string $query)
	{
		if (strpos($query, '#') !== false)
		{
			throw HTTPException::forMalformedQueryString();
		}

		// Can't have leading ?
		if (! empty($query) && strpos($query, '?') === 0)
		{
			$query = substr($query, 1);
		}

		$temp  = explode('&', $query);
		$parts = [];

		foreach ($temp as $index => $part)
		{
			list($key, $value) = $this->splitQueryPart($part);

			// Only 1 part?
			if (is_null($value))
			{
				$parts[$key] = null;
				continue;
			}

			// URL Decode the value to protect
			// from double-encoding a URL.
			// Especially useful with the Pager.
			$parts[$this->decode($key)] = $this->decode($value);
		}

		$this->query = $parts;

		return $this;
	}
public function setQuery(string $query)
	{
		if (strpos($query, '#') !== false)
		{
			throw HTTPException::forMalformedQueryString();
		}

		// Can't have leading ?
		if (! empty($query) && strpos($query, '?') === 0)
		{
			$query = substr($query, 1);
		}

		$temp  = explode('&', $query);
		$parts = [];

		foreach ($temp as $index => $part)
		{
			list($key, $value) = $this->splitQueryPart($part);

			// Only 1 part?
			if (is_null($value))
			{
				$parts[$key] = null;
				continue;
			}

			// URL Decode the value to protect
			// from double-encoding a URL.
			// Especially useful with the Pager.
			$parts[$this->decode($key)] = $this->decode($value);
		}

		$this->query = $parts;

		return $this;
	}
public function setQuery ( string $ query ) { if ( strpos ( $ query , '#' ) !== false ) { throw HTTPException :: forMalformedQueryString ( ) ; } // Can't have leading ? if ( ! empty ( $ query ) && strpos ( $ query , '?' ) === 0 ) { $ query = substr ( $ query , 1 ) ; } $ temp = explode ( '&' , $ query ) ; $ parts = [ ] ; foreach ( $ temp as $ index => $ part ) { list ( $ key , $ value ) = $ this -> splitQueryPart ( $ part ) ; // Only 1 part? if ( is_null ( $ value ) ) { $ parts [ $ key ] = null ; continue ; } // URL Decode the value to protect // from double-encoding a URL. // Especially useful with the Pager. $ parts [ $ this -> decode ( $ key ) ] = $ this -> decode ( $ value ) ; } $ this -> query = $ parts ; return $ this ; }
Sets the query portion of the URI, while attempting
to clean the various parts of the query keys and values.

@param string $query

@return $this
Sets the query portion of the URI while attempting to clean the various parts of the query keys and values .