API / Minn\Runtime / QueryFlags

QueryFlags final readonly class

Minn\Runtime\QueryFlags · public/minn/src/Minn/Runtime/QueryFlags.php · 197 lines

The conditional flags a set of query variables implies (is_single, is_archive, is_home, ...), derived the way the reference's parse step derives them, plus the variables after the integer casts that step applies.

Uses 1
Used by 1

Constants and properties

privateINTEGER_VARS = array ( 0 => 'p', 1 => 'page_id', 2 => 'attachment_id', 3 => 'year', 4 => 'monthnum', 5 => 'day', 6 => 'w', 7 => 'paged', )
propreadonly array $vars

Promoted from the constructor.

propreadonly array $flags

Promoted from the constructor.

Public

new__construct(array $vars, array $flags)#
$varsarray<string, mixed>
$flagsarray<string, bool>only the flags that are on
staticfill(array $vars, Minn\Runtime\Registry $registry): array#

The variables with every one the reference fills given its empty value: the template's keys up to search_columns (the ones after it are get_posts' own, settled when the query runs).

$varsarray<string, mixed>
@return array<string, mixed>
staticderive(array $vars, Minn\Runtime\Registry $registry, callable $option, array $asked): self#

The is_* flags the query vars amount to.

$varsarray<string, mixed>the filled query variables
$optioncallable(string): mixeda filtered option read
$askedarray<string, mixed>the query as it was given, before filling (a search is one that named s)
staticcustomTaxonomyVar(array $vars, Minn\Runtime\Registry $registry): ?array#

The first registered taxonomy (other than the two built-in ones) whose query variable carries a value, as [taxonomy name, query var].

@return array{0: string, 1: string}|null

Internals 2

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

privatesanitize(array $vars): array#

The reference's clean-up of the free-form variables: m and the time parts to digits, cat and author to id lists, names trimmed, an over-long or non-scalar search dropped.

$varsarray<string, mixed>
@return array<string, mixed>
privatearchiveFlags(array $vars, Minn\Runtime\Registry $registry): array#
@return array<string, bool>