API / Minn\Front / RuleRoutes

RuleRoutes final readonly class

Minn\Front\RuleRoutes · public/minn/src/Minn/Front/RuleRoutes.php · 156 lines

What a matched rewrite rule's query vars name, as the reference's main query reads them (suites permalinks, plugin-rules, request-vars): a post or page by id, an attachment by name, a page (or an attachment) by its path, a post by name (of the type the vars give), a registered type's item by its own var; else a search, a category's, tag's, post format's or registered taxonomy's archive, an author's, a date's, a post type's; else the front. A rule that set error is a 404, as is a single the reader may not read. Under a name the date or category the rule also captured does not narrow the find: where the post really lives is the canonical redirect's business.

Used by 1

Constants and properties

privatereadonly Minn\Content\Posts $posts

Promoted from the constructor.

privatereadonly Minn\Front\ArchiveAddresses $archives

Promoted from the constructor.

privatereadonly int $frontPageId

Promoted from the constructor.

privatereadonly int $postsPageId

Promoted from the constructor.

privatereadonly Closure $readable

Promoted from the constructor.

Public

new__construct(Minn\Content\Posts $posts, Minn\Front\ArchiveAddresses $archives, int $frontPageId, int $postsPageId, Closure $readable)#
$readableClosure(PostRecord): boolwhether the reader may read a post
methodresolve(array $vars): Minn\Front\Resolution#

The resolution the vars stand for. @param array<string, string> $vars

$varsarray<string, string>

Internals 7

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

privatesingle(array $vars, string $type, int $paged): ?Minn\Front\Resolution#

A single the vars name; null when they name none. @param array<string, string> $vars

$varsarray<string, string>
privatearchive(array $vars, string $type, int $paged): Minn\Front\Resolution#

The archive the vars name, the front when they name none: a search first (whatever else they name, as the reference's templates choose), a term's, an author's, a date's, a post type's when they give one and nothing else.

$varsarray<string, string>
privatetypeArchive(string $name, int $paged): Minn\Front\Resolution#

A post type's archive, when it has one; the front's listing (of that type) when it has none.

privatefound(?Minn\Content\PostRecord $post, int $paged): Minn\Front\Resolution#

A found post as the reader may see it: the static front page, the posts page (the blog's listing), any other post or page; a 404 when there is none or the reader may not read it (an attachment as its parent is).

privatereadable(Minn\Content\PostRecord $post): bool#

Whether the reader may read a post; an attachment as its parent is, a loose one as it stands.

privateregistered(string $kind): array#

The registered post types or taxonomies that answer to a var of their own, among those a visitor may query (the reference keeps no other's var public): name => var.

@return array<string, string>
privatesegments(string $path): array#
@return list<string>