ThemeConfigurator
MMO\client · 1 symbol · generated 5 Oct 2026
ThemeConfigurator
ThemeConfigurator.php:64Reads the theme's token layer, lets an application change any value in it, and writes the result back as Simple CSS.
- Namespace
MMO\client- Extends
- aModule
- See
applywrites the json, writes the.scs, then asksThemeto recompile the stylesheet. In dev mode the target is also rebuilt whenever a source file becomes more recent than it (isUpToDate), so a token added to the library is never hidden by a stale generated copy.
Index
| MAX_LENGTH | ||
| config | ||
| enabled | ||
| labels | ||
| model | ||
| overrides | ||
| sources | ||
| target | ||
| varPrefix | ||
| apply($overrides) | Store a new configuration, regenerate the token layer, and recompile the application's css. | |
| build() | Write $target from the stored overrides, without touching the configuration. | |
| DefaultConfig() static | ||
| Dig($values, $path) static | ||
| Filename($file) static | ||
| generate($overrides) | The generated token layer: every source, printed back with the overrides substituted into its ast. | |
| getConfigFile($resolve) | ||
| getModel($reload) | The whole customizable surface, read from the sources. | |
| getOverrides() | ||
| getResolvedValues($overrides) | What every entry would really be worth under a candidate configuration. | |
| getSources() | ||
| getTarget($resolve) | ||
| isEnabled() | ||
| isUpToDate() | ||
| MapOf($node) static | ||
| preview($overrides) | Compile a candidate token layer without writing anything. | |
| printExpression($key, $entry, $value) | Parse one submitted value the way the source parses the entry it replaces, and print it back. | |
| readStatement($statement, $namespace, $printer) | The entries one top-level statement declares. | |
| reject($key, $node) | Refuse the two things a *value* must never reach for, whatever an application authorized for its own stylesheets: the php bridge, and the compilation context. | |
| replacement($key, $kind, $overrides) | Parse one stored override back into the ast node that replaces the source's own. | |
| reset() | Drop every override and rebuild: the theme goes back to what the sources declare. | |
| resolve() | Fill in what only a compilation knows: the value each token really ends up with once the expressions are evaluated. | |
| resolveWith($entries, $source) | ||
| Short($file) static | ||
| substitute($statement, $namespace, $overrides) | Replace, in place, the value nodes of a statement whose entry is overridden. | |
| TypeOf($entry) static | What kind of control an entry deserves: this is a hint for the interface, never something the compiler reads -- a value the model calls a colour is still just an expression. | |
| validate($overrides) | Validate a set of overrides against the model. | |
| ValueOf($statement) static | The single value node a synthetic snippet declared. | |
| variableName($path) | ||
| __wakeup() |
Constants1
MAX_LENGTH
Properties8
config
- Type
- string
enabled
- Type
- bool
labels
- Type
- array
model
overrides
sources
- Type
- array
target
- Type
- string
varPrefix
- Type
- string
Methods30
apply($overrides)
ThemeConfigurator.php:783Store a new configuration, regenerate the token layer, and recompile the application's css.
| $overrides | array | entry key => expression, an empty value dropping the override |
| returns | array | ['overrides' => [...], 'css' => the compiled stylesheet, 'generated' => the .scs written] |
| throws | when the configurator is disabled | |
| throws | when an override is not valid | |
| throws | when the theme, or the application's stylesheet, does not compile |
build()
ThemeConfigurator.php:766Write $target from the stored overrides, without touching the configuration.
| returns | void |
DefaultConfig()
staticThemeConfigurator.php:108| returns | array |
Dig($values, $path)
staticThemeConfigurator.php:540Filename($file)
staticThemeConfigurator.php:155generate($overrides)
ThemeConfigurator.php:613The generated token layer: every source, printed back with the overrides substituted into its ast.
getConfigFile($resolve)
ThemeConfigurator.php:142getModel($reload)
ThemeConfigurator.php:335The whole customizable surface, read from the sources.
| $reload = false | bool | true to parse the sources again rather than reuse what this request already read |
| returns | array | ['sources' => [...], 'sections' => [...], 'entries' => [key => entry]], where a section is ['key', 'label', 'source', 'kind', 'entries' => [key, ...]] and an entry is ['key', 'label', 'name', 'kind', 'section', 'source', 'base', 'value', 'resolved', 'type', 'variable', 'overridden', 'editable'] |
getOverrides()
ThemeConfigurator.php:181| returns | array | the stored overrides: entry key => the expression that replaces the source's own |
getResolvedValues($overrides)
ThemeConfigurator.php:489What every entry would really be worth under a candidate configuration.
getSources()
ThemeConfigurator.php:146| returns | array | the source files, resolved |
getTarget($resolve)
ThemeConfigurator.php:143isEnabled()
ThemeConfigurator.php:141| returns | bool |
isUpToDate()
ThemeConfigurator.php:162MapOf($node)
staticThemeConfigurator.php:554preview($overrides)
ThemeConfigurator.php:747Compile a candidate token layer without writing anything.
printExpression($key, $entry, $value)
ThemeConfigurator.php:248Parse one submitted value the way the source parses the entry it replaces, and print it back.
readStatement($statement, $namespace, $printer)
ThemeConfigurator.php:396The entries one top-level statement declares.
reject($key, $node)
ThemeConfigurator.php:302Refuse the two things a *value* must never reach for, whatever an application authorized for its own stylesheets: the php bridge, and the compilation context. Both are for code the application wrote.
replacement($key, $kind, $overrides)
ThemeConfigurator.php:711Parse one stored override back into the ast node that replaces the source's own.
reset()
ThemeConfigurator.php:837Drop every override and rebuild: the theme goes back to what the sources declare.
resolve()
ThemeConfigurator.php:473Fill in what only a compilation knows: the value each token really ends up with once the expressions are evaluated. A failed compilation is not fatal here -- the model still describes the sources, it simply shows the expressions instead of the values they produce.
| returns | void |
resolveWith($entries, $source)
ThemeConfigurator.php:498Short($file)
staticThemeConfigurator.php:530substitute($statement, $namespace, $overrides)
ThemeConfigurator.php:661Replace, in place, the value nodes of a statement whose entry is overridden.
TypeOf($entry)
staticThemeConfigurator.php:570What kind of control an entry deserves: this is a hint for the interface, never something the compiler reads -- a value the model calls a colour is still just an expression.
validate($overrides)
ThemeConfigurator.php:210Validate a set of overrides against the model.
ValueOf($statement)
staticThemeConfigurator.php:285The single value node a synthetic snippet declared.
variableName($path)
ThemeConfigurator.php:600__wakeup()
ThemeConfigurator.php:116| returns | void |
Inherited members (47)
| Constants | Declared by | Description | |
|---|---|---|---|
ALERT | iLogLevel | Alert: Action must be taken immediately. | |
ALL | iLogLevel | Mask for all | |
ALL_PLUS | iLogLevel | debug everything | |
BACKTRACE | iLogLevel | ||
CRITICAL | iLogLevel | Critical: Critical conditions. | |
DEBUG | iLogLevel | Debug: Detailed debug information. | |
DEEP | iLogLevel | debug everything with arguments | |
EMERGENCY | iLogLevel | Emergency: System is unusable. | |
ERROR | iLogLevel | Error: Runtime errors that do not require immediate action but should typically be logged and monitored. | |
ERROR_PLUS | iLogLevel | Mask for all error | |
FATAL | iLogLevel | Mask for all fatal error | |
INFO | iLogLevel | Info: Interesting events. | |
INFO_PLUS | iLogLevel | Mask for all errors/warning/notices/info | |
MEMORY | iLogLevel | include backtrace object | |
NOTICE | iLogLevel | Notice: Normal but significant events. | |
NOTICE_PLUS | iLogLevel | Mask for all errors/warning/notices/info | |
TRACE | iLogLevel | include backtrace as origins | |
WARNING | iLogLevel | Warning: Exceptional occurrences that are not errors. | |
WARNING_PLUS | iLogLevel | Mask for all errors and warnings |
| Properties | Declared by | Description | |
|---|---|---|---|
verbosity | aModule |
| Methods | Declared by | Description | |
|---|---|---|---|
alert($message, $context) | aModule | Action must be taken immediately. | |
backtraces($message, $context) | aModule | Force-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it). | |
Configure($config) | aModule | Merge $config into this module's configuration in the shared Configuration. | |
critical($message, $context) | aModule | Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask. | |
debug($message, $context) | aModule | Detailed debug information. | |
debugName() | aModule | Human-readable identifier used as the default {origin} in this instance's log messages. | |
emergency($message, $context) | aModule | System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask. | |
error($message, $context) | aModule | Runtime errors that do not require immediate action but should typically be logged and monitored. | |
getVerbosity() | aModule | ||
info($message, $context) | aModule | Interesting events. No-op if INFO is currently filtered out by the verbosity mask. | |
Instantiate($config) | aModule | (Re)create the shared instance immediately, configured with $config merged into the class's existing config. | |
IsShared() | aModule | ||
log($level, $message, $context) | aModule | Logs with an arbitrary level. | |
notice($message, $context) | aModule | Normal but significant events. | |
offsetExists($key) | aModule | \ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access. | |
offsetGet($key) | aModule | \ArrayAccess::offsetGet -- reads a property directly, unless it has a #[Serialize(serialize: 'methodName')] attribute, in which case that zero-argument method is called instead (e.g. | |
offsetSet($key, $value) | aModule | \ArrayAccess::offsetSet -- sets a property directly, unless it has a #[Serialize(unserialize: 'methodName')] attribute, in which case that method is called with $value instead (e.g. | |
offsetUnset($key) | aModule | \ArrayAccess::offsetUnset -- equivalent to $module[$key] = null. | |
serialize($path, $serializer) | aModule | \MMO\core\interfaces\iSerializable::serialize -- exports every property (via | |
setVerbosity($verb) | aModule | Set the current verbosity mask, replacing whatever it was before. | |
Shared() | aModule | Get the shared instance, creating (and configuring) it on first call. | |
testVerbosity($level) | aModule | Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask. | |
traitUnshare($serialize) | aModule | Remove the shared instance, so the next Shared() call creates a fresh one. | |
unserialize($data, $path, $instances) | aModule | \MMO\core\interfaces\iSerializable::unserialize -- merges $data onto DefaultConfig, runs it through the (possibly overridden) constructor, then applies each resulting value to its property (via | |
Unshare($serialize) | aModule | Like tSingleton::Unshare, but also disconnects this module's instance from every event it was listening to (via Event::DisconnectListeners) before dropping it. | |
warning($message, $context) | aModule | Exceptional occurrences that are not errors. | |
__construct($config) | aModule | protected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data. |