Reader final class
Minn\Content\Reader · public/minn/src/Minn/Content/Reader.php · 65 lines
Who is reading this request: their user id, whether they may read private content, whether they may edit a given post, and the post-password cookie they carry. Built once per surface by the engine, carried by the request's context, and consulted by the resolver, the queries, and the renderers.
Constants and properties
| prop | readonly int $userId | Promoted from the constructor. |
| prop | readonly bool $readsPrivatePosts | Promoted from the constructor. |
| prop | readonly bool $readsPrivatePages | Promoted from the constructor. |
| private | readonly Closure $canEditPost | Promoted from the constructor. |
| prop | readonly string $postPassword | Promoted from the constructor. |
| prop | readonly string $sessionToken | Promoted from the constructor. |
| prop | readonly array $roles | Promoted from the constructor. |
Public
| new | __construct(int $userId, bool $readsPrivatePosts, bool $readsPrivatePages, Closure $canEditPost, string $postPassword, string $sessionToken = '', array $roles = array ( ))# |
| |||
| static | anonymous(string $postPassword = ''): self# | The reader who is nobody: no session, no private posts, only the post password they typed. | |||
| static | forUser(int $userId, Minn\Auth\Capabilities $capabilities, string $postPassword = '', string $sessionToken = ''): self# | The reader a signed-in user is, asked of the capability engine: what they may read privately, what they may edit, and the roles they hold. User 0 is nobody, whatever the capabilities say. | |||
| static | current(): self# | The reader of the request being answered. The runtime holds it (the context it was built with carries it), so there is one holder and a request cannot see the reader of the one before it. Without a runtime, on the command line and in unit tests, nobody is reading. | |||
| method | loggedIn(): bool# | Whether the reader has a session. | |||
| method | canEdit(int $postId): bool# | Whether this reader may edit a given post. |
Nothing matches.