Context final readonly class
Minn\Context · public/minn/src/Minn/Context.php · 41 lines
One request, as a value: the database door, who is asking, what they may do, and where the site's files are. It is built once at the front door and handed down, so nothing below has to reach for a global to learn what request it is answering.
The reader is the one part that differs by surface (REST resolves it from the nonce-bound caller, the front from the session cookie), so a context is made with the reader its surface resolved.
Constants and properties
| prop | readonly Minn\Db $db | Promoted from the constructor. |
| prop | readonly Minn\Content\Site $site | Promoted from the constructor. |
| prop | readonly ?Minn\Http\Request $request | Promoted from the constructor. |
| prop | readonly Minn\Content\Reader $reader | Promoted from the constructor. |
| prop | readonly Minn\Auth\Capabilities $capabilities | Promoted from the constructor. |
| prop | readonly string $engineDir | the minn/ folder: the engine's own files Promoted from the constructor. |
| prop | readonly string $absPath | the site root with a trailing slash, as ABSPATH holds it Promoted from the constructor. |
| prop | readonly string $version | the WordPress release whose contracts the runtime speaks Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db, Minn\Content\Site $site, ?Minn\Http\Request $request, Minn\Content\Reader $reader, Minn\Auth\Capabilities $capabilities, string $engineDir, string $absPath, string $version)# | |
| method | withReader(Minn\Content\Reader $reader): self# | The same context with another reader, for a surface that resolves one later. |
| method | contentDir(): string# | wp-content under the site root. |
| method | themesDir(): string# | The themes folder under wp-content. |
| method | isSecure(): bool# | Whether the request is over HTTPS. |
Nothing matches.