API / Minn / Context

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

propreadonly Minn\Db $db

Promoted from the constructor.

propreadonly Minn\Content\Site $site

Promoted from the constructor.

propreadonly ?Minn\Http\Request $request

Promoted from the constructor.

propreadonly Minn\Content\Reader $reader

Promoted from the constructor.

propreadonly Minn\Auth\Capabilities $capabilities

Promoted from the constructor.

propreadonly string $engineDir

the minn/ folder: the engine's own files

Promoted from the constructor.

propreadonly string $absPath

the site root with a trailing slash, as ABSPATH holds it

Promoted from the constructor.

propreadonly 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)#
methodwithReader(Minn\Content\Reader $reader): self#

The same context with another reader, for a surface that resolves one later.

methodcontentDir(): string#

wp-content under the site root.

methodthemesDir(): string#

The themes folder under wp-content.

methodisSecure(): bool#

Whether the request is over HTTPS.