Documentation

QueryInterface extends Countable, IteratorAggregate, UriComponentInterface

Tags
extends

\IteratorAggregate<array{0:string, 1:string|null}>

Table of Contents

__toString()  : string
Returns the instance string representation.
append()  : self
Returns an instance with the new pairs appended to it.
appendTo()  : self
Returns a new instance with a specified key/value pair appended as a new pair.
count()  : int
Returns the number of key/value pairs present in the object.
get()  : string|null
Returns the first value associated to the given pair name.
getAll()  : array<int, string|null>
Returns all the values associated to the given pair name as an array or all the instance pairs.
getContent()  : string|null
Returns the instance content.
getIterator()  : Iterator<int, array{0: string, 1: string|null}>
Returns an iterator allowing to go through all key/value pairs contained in this object.
getSeparator()  : string
Returns the query separator.
getUriComponent()  : string
Returns the instance string representation with its optional URI delimiters.
has()  : bool
Tells whether a pair with a specific name exists.
jsonSerialize()  : string|null
Returns the instance json representation.
merge()  : self
Returns an instance with the new pairs set to it.
pairs()  : iteratable<string, string|null>
Returns an iterator allowing to go through all key/value pairs contained in this object.
params()  : mixed
Returns the store PHP variables as elements of an array.
sort()  : self
Sorts the query string by offset, maintaining offset to data correlations.
toRFC1738()  : string|null
Returns the RFC1738 encoded query.
toRFC3986()  : string|null
Returns the RFC3986 encoded query.
withContent()  : self
Returns an instance with the specified content.
withoutDuplicates()  : self
Returns an instance without duplicate key/value pair.
withoutEmptyPairs()  : self
Returns an instance without empty key/value where the value is the null value.
withoutNumericIndices()  : self
Returns an instance where numeric indices associated to PHP's array like key are removed.
withoutPair()  : self
Returns an instance without the specified keys.
withoutParam()  : self
Returns an instance without the specified params.
withPair()  : self
Returns an instance with the a new key/value pair added to it.
withSeparator()  : self
Returns an instance with a different separator.

Methods

__toString()

Returns the instance string representation.

public __toString() : string

If the instance is defined, the value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.

If the instance is not defined an empty string is returned

Return values
string

append()

Returns an instance with the new pairs appended to it.

public append(string $query) : self

This method MUST retain the state of the current instance, and return an instance that contains the modified query

If the pair already exists the value will be added to it.

Parameters
$query : string
Return values
self

appendTo()

Returns a new instance with a specified key/value pair appended as a new pair.

public appendTo(string $key, string|null $value) : self

This method MUST retain the state of the current instance, and return an instance that contains the modified query

Parameters
$key : string
$value : string|null
Return values
self

count()

Returns the number of key/value pairs present in the object.

public count() : int
Return values
int

getContent()

Returns the instance content.

public getContent() : string|null

If the instance is defined, the value returned MUST be encoded according to the selected encoding algorithm. In any case, the value MUST NOT double-encode any character depending on the selected encoding algorithm.

To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3. or RFC 3987 Section 3. By default the content is encoded according to RFC3986

If the instance is not defined null is returned

Return values
string|null

getIterator()

Returns an iterator allowing to go through all key/value pairs contained in this object.

public getIterator() : Iterator<int, array{0: string, 1: string|null}>

The pair is represented as an array where the first value is the pair key and the second value the pair value.

The key of each pair is a string The value of each pair is a scalar or the null value

Return values
Iterator<int, array{0: string, 1: string|null}>

getSeparator()

Returns the query separator.

public getSeparator() : string
Return values
string

getUriComponent()

Returns the instance string representation with its optional URI delimiters.

public getUriComponent() : string

The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.

If the instance is not defined an empty string is returned

Return values
string

jsonSerialize()

Returns the instance json representation.

public jsonSerialize() : string|null

If the instance is defined, the value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986 or RFC 1738.

If the instance is not defined null is returned

Return values
string|null

merge()

Returns an instance with the new pairs set to it.

public merge(string $query) : self

This method MUST retain the state of the current instance, and return an instance that contains the modified query

Parameters
$query : string
Tags
see
::withPair
Return values
self

pairs()

Returns an iterator allowing to go through all key/value pairs contained in this object.

public pairs() : iteratable<string, string|null>

The return type is as a Iterator where its offset is the pair key and its value the pair value.

The key of each pair is a string The value of each pair is a scalar or the null value

Return values
iteratable<string, string|null>

params()

Returns the store PHP variables as elements of an array.

public params([string|null $key = null ]) : mixed

The result is similar as PHP parse_str when used with its second argument with the difference that variable names are not mangled.

If a key is submitted it will returns the value attached to it or null

Parameters
$key : string|null = null
Tags
see
http://php.net/parse_str
see
https://wiki.php.net/rfc/on_demand_name_mangling
Return values
mixed

the collection of stored PHP variables or the empty array if no input is given, the single value of a stored PHP variable or null if the variable is not present in the collection

toRFC1738()

Returns the RFC1738 encoded query.

public toRFC1738() : string|null
Return values
string|null

toRFC3986()

Returns the RFC3986 encoded query.

public toRFC3986() : string|null
Tags
see
::getContent
Return values
string|null

withContent()

Returns an instance with the specified content.

public withContent(string|null $content) : self

This method MUST retain the state of the current instance, and return an instance that contains the specified content.

Users can provide both encoded and decoded content characters.

A null value is equivalent to removing the component content.

Parameters
$content : string|null
Tags
throws
SyntaxError

for invalid component or transformations that would result in a object in invalid state.

throws
IdnSupportMissing

for component or transformations requiring IDN support when IDN support is not present or misconfigured.

Return values
self

withoutDuplicates()

Returns an instance without duplicate key/value pair.

public withoutDuplicates() : self

This method MUST retain the state of the current instance, and return an instance that contains the query component normalized by removing duplicate pairs whose key/value are the same.

Return values
self

withoutEmptyPairs()

Returns an instance without empty key/value where the value is the null value.

public withoutEmptyPairs() : self

This method MUST retain the state of the current instance, and return an instance that contains the query component normalized by removing empty pairs.

A pair is considered empty if its value is equal to the null value

Return values
self

withoutNumericIndices()

Returns an instance where numeric indices associated to PHP's array like key are removed.

public withoutNumericIndices() : self

This method MUST retain the state of the current instance, and return an instance that contains the query component normalized so that numeric indexes are removed from the pair key value.

ie.: toto[3]=bar[3]&foo=bar becomes toto[]=bar[3]&foo=bar

Return values
self

withoutPair()

Returns an instance without the specified keys.

public withoutPair(string ...$keys) : self

This method MUST retain the state of the current instance, and return an instance that contains the modified component

Parameters
$keys : string
Return values
self

withoutParam()

Returns an instance without the specified params.

public withoutParam(string ...$keys) : self

This method MUST retain the state of the current instance, and return an instance that contains the modified component without PHP's value. PHP's mangled is not taken into account.

Parameters
$keys : string
Return values
self

withPair()

Returns an instance with the a new key/value pair added to it.

public withPair(string $key, string|null $value) : self

This method MUST retain the state of the current instance, and return an instance that contains the modified query

If the pair already exists the value will replace the existing value.

Parameters
$key : string
$value : string|null
Tags
see
https://url.spec.whatwg.org/#dom-urlsearchparams-set
Return values
self

withSeparator()

Returns an instance with a different separator.

public withSeparator(string $separator) : self

This method MUST retain the state of the current instance, and return an instance that contains the query component with a different separator

Parameters
$separator : string
Return values
self

Search results