Create
MMO\core\events · 1 symbol · generated 30 Sep 2026
Create
Create.php:11Dispatched to build an instance of $class, letting a listener answer with $event->setReturn($instance) instead of a plain new $class(...) -- e.g. so a factory/DI mechanism can intercept construction.
- Namespace
MMO\core\events- Extends
- Signal
- Implements
- iStoppableEvent
- Uses traits
- tStoppableEvent, tWithOptions
Index
| class | ||
| opts | ||
| stopped | ||
| addOptions($opts, $appendList) | Merge $opts into the existing options (through merge), rather than replacing them wholesale like setOptions. | |
| clearOptions() | Empty the options bag. | |
| getOption($key, $default) | ||
| getOptions() | ||
| isPropagationStopped() | ||
| setOption($key, $value) | Set (or, with a null $value, remove) a single option. | |
| setOptions($opts) | Replace the whole options bag. | |
| stopPropagation() | Prevent any remaining listener in the current dispatch chain from being called. | |
| __clone() | A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance. | |
| __construct($origin, $class, $opts) |
Properties3
class
- Type
- string
opts
- Type
- array
stopped
Methods10
addOptions($opts, $appendList)
tWithOptions.php:65Merge $opts into the existing options (through merge), rather than replacing them wholesale like setOptions.
| $opts | array | the options to merge in |
| $appendList = false | bool | if true, a list-valued option is appended to (rather than replaced by) the corresponding list in $opts -- see \MMO\core\arrays\merge for the exact semantics |
| returns | void |
clearOptions()
tWithOptions.php:39Empty the options bag.
| returns | void |
getOption($key, $default)
tWithOptions.php:49getOptions()
tWithOptions.php:20| returns | array | every option currently set |
isPropagationStopped()
tStoppableEvent.php:21| returns | bool | true once stopPropagation has been called on this instance |
setOption($key, $value)
tWithOptions.php:77Set (or, with a null $value, remove) a single option.
setOptions($opts)
tWithOptions.php:30Replace the whole options bag.
stopPropagation()
tStoppableEvent.php:29Prevent any remaining listener in the current dispatch chain from being called.
| returns |
__clone()
tStoppableEvent.php:38A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance.
| returns |
__construct($origin, $class, $opts)
Create.php:21Inherited members (16)
| Methods | Declared by | Description | |
|---|---|---|---|
AddListener($handler, $order) | Event | Register a listener directly (as opposed to ConnectListeners's attribute-based discovery). | |
ConnectListeners($obj) | Event | Scan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class. | |
DisconnectListeners($obj) | Event | Undo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class. | |
dispatch() | Event | Invoke every GetListeners listener with $this. | |
GetListeners() | Event | Collect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep … | |
getOrigin() | Event | ||
getReturn() | Signal | ||
HasListener($handler) | Event | ||
hasReturn() | Signal | ||
RemoveListener($handler) | Event | Remove the last added handler from the listeners. | |
Send($args) | Event | Construct a new instance of this class with $args, then dispatch it to every listener. | |
SetListenerOrder($handler, $order) | Event | Change the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here). | |
setReturn($value, $stop) | Signal |