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.
Constants and properties
| private | readonly Minn\Content\Posts $posts | Promoted from the constructor. |
| private | readonly Minn\Front\Permalinks $permalinks | Promoted from the constructor. |
| private | readonly Minn\Front\AttachmentAddresses $attachments | Promoted from the constructor. |
| private | readonly Minn\Front\SingleAddresses $elsewhere | Promoted from the constructor. |
| private | readonly 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)# | |
| method | find(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.
| private | byId(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. |
| private | byPath(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. |
| private | singleOrRedirect(Minn\Content\PostRecord $post, Minn\Http\Request $request, Minn\Front\Redirects $redirects): Minn\Front\Resolution# |
Nothing matches.