API / Minn\Front / SingleQueries

SingleQueries final readonly class

Minn\Front\SingleQueries · public/minn/src/Minn/Front/SingleQueries.php · 117 lines

The single a query string asks for, as the reference's request parse and canonical redirect answer it: by id (?p=, ?page_id=, any viewable type's; an attachment's goes to its own page), an attachment by id or slug (?attachment_id=, ?attachment=), a post by slug (?name=), a page by path (?pagename=). With canonical redirects on, an address that is not the single's own moves there, the other query arguments along; without, each var is strict about the type it finds.

Used by 1

Constants and properties

privatereadonly Minn\Content\Posts $posts

Promoted from the constructor.

privatereadonly Minn\Front\Permalinks $permalinks

Promoted from the constructor.

privatereadonly Minn\Front\AttachmentAddresses $attachments

Promoted from the constructor.

privatereadonly Minn\Front\SingleAddresses $elsewhere

Promoted from the constructor.

privatereadonly Closure $readable

Promoted from the constructor.

Public

new__construct(Minn\Content\Posts $posts, Minn\Front\Permalinks $permalinks, Minn\Front\AttachmentAddresses $attachments, Minn\Front\SingleAddresses $elsewhere, Closure $readable)#
methodfind(Minn\Http\Request $request, Minn\Front\Redirects $redirects): ?Minn\Front\Resolution#

The resolution the query's single vars amount to; null when it has none of them.

Internals 3

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

privatebyId(Minn\Http\Request $request, string $key, Minn\Front\Redirects $redirects): Minn\Front\Resolution#

?p= or ?page_id=: the post or page (an attachment to its own page), moving to its pretty address.

privatebyPath(string $path, Minn\Front\Redirects $redirects): Minn\Front\Resolution#

?pagename=: the page at that path (the front page moves to the root), else one by the last slug.

privatesingleOrRedirect(Minn\Content\PostRecord $post, Minn\Http\Request $request, Minn\Front\Redirects $redirects): Minn\Front\Resolution#