SiteEnvironment
Corex\Environment\SiteEnvironment · class · Core layer
The one answer to “is this a development, staging or production site” (spec 113, FR-001). In this order: APP_ENV in .env, a value the network locks, or the corex_app_env option, each of which locks the operations mode; then the operations mode the owner chose; then WordPress’s environment type. Coming soon and Maintenance are production here: they change what visitors see, not where mail goes. The three lock layers are read one by one rather than through the config repository, whose defaults layer answers app.env with “production” on every site and so hides the two answers below it.
Public API
Section titled “Public API”__construct(array $locks)
Section titled “__construct(array $locks)”current(): SiteEnvironmentAnswer
Section titled “current(): SiteEnvironmentAnswer”allowsMode(string $mode): bool
Section titled “allowsMode(string $mode): bool”Whether an operations mode may be chosen while a lock decides: the lock’s own environment, and Coming soon and Maintenance under any lock. Without a lock every mode may.
fromValue(string $value): string
Section titled “fromValue(string $value): string”What a value of APP_ENV or of WordPress’s environment type means here.
fromMode(string $mode): ?string
Section titled “fromMode(string $mode): ?string”What an operations mode means here; null for a value that is not a mode.