objects

Options

Visitor options the server renders: theme, density, a dismissed banner.

Declared in config as "options": {"theme": ["default", "dark"]} - slug keys, the first value the default - so a cookie only ever yields a declared value.

$options Phlat\Options 4 methods
Show
  • any Whether the visitor holds any option cookie: their pages differ from everyone else's, so none may be cached.
  • get The visitor's value, or the default when unset or no longer declared.
  • has Whether config declares an option named $key.
  • set Stores the visitor's choice in a cookie; a value config doesn't declare throws.

Methods

any

$options->any(): bool

Whether the visitor holds any option cookie: their pages differ from everyone else's, so none may be cached.

Returns bool

phlat/src/Options.php:43

get

$options->get(string $key): string

The visitor's value, or the default when unset or no longer declared.

Parameters (1)
$key string

Returns string

phlat/src/Options.php:30

has

$options->has(string $key): bool

Whether config declares an option named $key.

Parameters (1)
$key string

Returns bool

phlat/src/Options.php:24

set

$options->set(string $key, string $value): void

Stores the visitor's choice in a cookie; a value config doesn't declare throws.

Parameters (2)
$key string
$value string
phlat/src/Options.php:36