aModule
MMO\core\classes · 1 symbol · generated 5 Oct 2026
aModule
aModule.php:41Base class for a configurable singleton module.
- Namespace
MMO\core\classes- Implements
- iModule, iSerializable
- Uses traits
- tLogEmitter, tSingleton
Index
| verbosity | ||
| alert($message, $context) | Action must be taken immediately. | |
| backtraces($message, $context) | 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) static | Merge $config into this module's configuration in the shared Configuration. | |
| critical($message, $context) | Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask. | |
| debug($message, $context) | Detailed debug information. | |
| debugName() | Human-readable identifier used as the default {origin} in this instance's log messages. | |
| DefaultConfig() static | The config a module starts from before anything loaded via Configuration is merged in. | |
| emergency($message, $context) | System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask. | |
| error($message, $context) | Runtime errors that do not require immediate action but should typically be logged and monitored. | |
| getVerbosity() | ||
| info($message, $context) | Interesting events. No-op if INFO is currently filtered out by the verbosity mask. | |
| Instantiate($config) static | (Re)create the shared instance immediately, configured with $config merged into the class's existing config. | |
| IsShared() static | ||
| log($level, $message, $context) | Logs with an arbitrary level. | |
| notice($message, $context) | Normal but significant events. | |
| offsetExists($key) | \ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access. | |
| offsetGet($key) | \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) | \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) | \ArrayAccess::offsetUnset -- equivalent to $module[$key] = null. | |
| serialize($path, $serializer) | \MMO\core\interfaces\iSerializable::serialize -- exports every property (via | |
| setVerbosity($verb) | Set the current verbosity mask, replacing whatever it was before. | |
| Shared() static | Get the shared instance, creating (and configuring) it on first call. | |
| testVerbosity($level) | Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask. | |
| traitUnshare($serialize) static | Remove the shared instance, so the next Shared() call creates a fresh one. | |
| unserialize($data, $path, $instances) | \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) static | 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) | Exceptional occurrences that are not errors. | |
| __construct($config) | protected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data. |
Properties1
verbosity
- Type
- int
Methods28
alert($message, $context)
tLogEmitter.php:121Action must be taken immediately.
| $message | Stringable | string | |
| $context = [] | array | |
| returns | void |
backtraces($message, $context)
tLogEmitter.php:234Force-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)
staticaModule.php:78Merge $config into this module's configuration in the shared Configuration. If the module's shared instance already exists, each value is applied to it immediately (through the container's mutation-aware injection, which reaches into the live object's own ArrayAccess setter); otherwise it is simply stored and picked up whenever the instance is first built.
critical($message, $context)
tLogEmitter.php:138Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
| $message | Stringable | string | |
| $context = [] | array | |
| returns | void |
debug($message, $context)
tLogEmitter.php:219Detailed debug information. No-op if DEBUG is currently filtered out by the verbosity mask.
| $message | Stringable | string | |
| $context = [] | array | |
| returns | void |
debugName()
tLogEmitter.php:30Human-readable identifier used as the default {origin} in this instance's log messages.
| returns | string |
DefaultConfig()
staticaModule.php:52The config a module starts from before anything loaded via Configuration is merged in.
| returns | array |
emergency($message, $context)
tLogEmitter.php:103System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
| $message | Stringable | string | |
| $context = [] | array | |
| returns | void |
error($message, $context)
tLogEmitter.php:154Runtime errors that do not require immediate action but should typically be logged and monitored.
| $message | Stringable | string | |
| $context = [] | array | |
| returns | void |
getVerbosity()
tLogEmitter.php:38| returns | int | the current verbosity, as a bitmask of iLogLevel::* constants |
info($message, $context)
tLogEmitter.php:204Interesting events. No-op if INFO is currently filtered out by the verbosity mask.
| $message | Stringable | string | |
| $context = [] | array | |
| returns | void |
Instantiate($config)
statictSingleton.php:61(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
| $config = [] | array | config values merged in before the instance is constructed |
| returns | static | the newly (re)created shared instance |
IsShared()
statictSingleton.php:49| returns | bool | true if the shared instance has already been created (a call to Shared() would not need to construct a new one) |
log($level, $message, $context)
tLogEmitter.php:81Logs with an arbitrary level.
| $level | ||
| $message | Stringable | string | |
| $context = [] | array | ignored if $message is a Log |
| returns | void |
notice($message, $context)
tLogEmitter.php:187Normal but significant events. No-op if NOTICE is currently filtered out by the verbosity mask.
| $message | Stringable | string | |
| $context = [] | array | |
| returns | void |
offsetExists($key)
aModule.php:192\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.php:146\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. Application's paths property is declared #[Serialize(serialize: 'getPaths', ...)], so $app['paths'] calls $app->getPaths()). A property declared #[Serialize(false)] (serialize explicitly disabled) reads as null through array access.
offsetSet($key, $value)
aModule.php:170\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. I18n's lang property is declared #[Serialize(null, 'setLanguage')], so $i18n['lang'] = 'fr' calls $i18n->setLanguage('fr')).
| $key | mixed | |
| $value | mixed | |
| returns | void | |
| throws | if $key is not a declared property at all | |
| throws | if the property is #[Serialize(false)] (or its unserialize side is explicitly false): such a property cannot be set through array access at all |
offsetUnset($key)
aModule.php:134\ArrayAccess::offsetUnset -- equivalent to $module[$key] = null.
serialize($path, $serializer)
aModule.php:101\MMO\core\interfaces\iSerializable::serialize -- exports every property (via
- See
serializeProperties, which honors each property's #[Serialize] attribute), then drops any value that still equals itsDefaultConfigdefault, so only the meaningful overrides are kept.
setVerbosity($verb)
tLogEmitter.php:64Set the current verbosity mask, replacing whatever it was before.
| $verb = null | string | int | null | a bitmask of iLogLevel::* constants, or a level name/expression resolved through \MMO\core\debug\flags() (e.g. 'error+' for iLogLevel::ERROR_PLUS) |
| returns | void |
Shared()
statictSingleton.php:22Get the shared instance, creating (and configuring) it on first call.
| returns | static |
testVerbosity($level)
tLogEmitter.php:50Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
| $level | string | int | a iLogLevel::* constant/bitmask, or a level name resolved through \MMO\core\debug\flags() |
| returns | int | the bits of $level that are currently enabled (0 if none of them are) |
traitUnshare($serialize)
statictSingleton.php:35Remove the shared instance, so the next Shared() call creates a fresh one.
- See
serialize) and kept as the class's config, so the next instance created picks up where this one left off; if false, the instance is simply discarded and the next one starts from the class's original config
| $serialize = true | bool | if true (the default) and an instance currently exists, it is serialized first (via |
| returns | bool | true if an instance actually existed and was removed |
unserialize($data, $path, $instances)
aModule.php:122\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
- See
unserializeProperties, again honoring #[Serialize]). This is how a module is actually built:Container::getInstanceultimately calls this, nevernew.
Unshare($serialize)
staticaModule.php:62Like 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)
tLogEmitter.php:172Exceptional occurrences that are not errors. No-op if WARNING is currently filtered out by the verbosity mask.
| $message | Stringable | string | |
| $context = [] | array | |
| returns | void |
__construct($config)
aModule.php:89protected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data.
| $config | array |
Inherited members (19)
| 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 |