API / Minn\Runtime / QueryArgs

QueryArgs final class

Minn\Runtime\QueryArgs · public/minn/src/Minn/Runtime/QueryArgs.php · 78 lines

Query arguments added to and taken from an address the way WordPress's add_query_arg() and remove_query_arg() do, the current request's address when none is given, and an action's nonce added to one.

Public

staticadd(mixed ...$args): string#

An address with arguments added (add_query_arg): a key and value, or a list of them, then the address (the request's when false or left out). Values are URL-encoded; an empty one leaves its key bare, a false or null one takes the key out.

staticversioned(string $src, string $version): string#

A script's or style's address with its version, as the dependency printers add it: the same address add_query_arg would give, its query read without wp_parse_str's filter (probe: printing a versioned script fires none on the reference).

staticremove(mixed $key, mixed $query = false): mixed#

An address with an argument, or each of a list, taken out (remove_query_arg); an empty list gives back what was given.

staticwithNonce(mixed $actionUrl, mixed $action = -1, mixed $name = '_wpnonce'): string#

An address carrying a nonce for the action (wp_nonce_url), escaped for HTML.

staticrequestUri(): string#

The request's address as PHP was given it; a runtime built without one gives its request's path and query.

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatewith(string $uri, array $new, Closure $read): string#

An address with the arguments set, its own query read through the given step and encoded.

$newarray<array-key, mixed>
$read\Closure(array<array-key, mixed>): array<array-key, mixed>