MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

Create

MMO\core\events · 1 symbole · générée le 27 Oct 2026

class

Create

Create.php:11

Dispatched 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.

class MMO\core\events\Create extends MMO\core\events\Signal implements MMO\core\interfaces\iStoppableEvent use MMO\core\classes\tStoppableEvent, MMO\core\classes\tWithOptions
Espace de noms
MMO\core\events
Étend
Signal
Implémente
iStoppableEvent
Utilise les 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)

Propriétés3

opts

protected array $opts = []
Type
array

stopped

protected $stopped = false

Méthodes10

addOptions($opts, $appendList)

tWithOptions.php:65

Merge $opts into the existing options (through merge), rather than replacing them wholesale like setOptions.

function addOptions(array $opts, bool $appendList = false): void
$optsarraythe options to merge in
$appendList = falseboolif 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
retournevoid
$t->setOptions(['a' => 1, 'tags' => ['x']]); $t->addOptions(['b' => 2, 'tags' => ['y']]); $t->getOptions(); // ['a' => 1, 'tags' => ['y'], 'b' => 2] -- 'tags' is replaced, not appended ($appendList=false)

clearOptions()

tWithOptions.php:39

Empty the options bag.

function clearOptions(): void
retournevoid
$t->clearOptions(); // getOptions() === []

getOption($key, $default)

tWithOptions.php:49
function getOption(string $key, mixed $default = null): mixed
$keystring
$default = nullmixedreturned if $key is not set
retournemixed
$t->getOption('a', 'fallback'); // the current value of 'a', or 'fallback' if not set

getOptions()

tWithOptions.php:20
function getOptions(): array
retournearrayevery option currently set
$t->getOptions(); // ['a' => 1, 'tags' => ['x']]

setOption($key, $value)

tWithOptions.php:77

Set (or, with a null $value, remove) a single option.

function setOption(string $key, mixed $value): void
$keystring
$valuemixedif null, the option is unset entirely rather than being set to null
retournevoid
$t->setOption('a', 1);$t->setOption('a', null); // removes 'a' from getOptions()

setOptions($opts)

tWithOptions.php:30

Replace the whole options bag.

function setOptions(array $opts): void
$optsarray
retournevoid
$t->setOptions(['a' => 1]);

stopPropagation()

tStoppableEvent.php:29

Prevent any remaining listener in the current dispatch chain from being called.

function stopPropagation()
retourne

__clone()

tStoppableEvent.php:38

A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance.

function __clone()
retourne

__construct($origin, $class, $opts)

Create.php:21
function __construct(object|string $origin, string $class, array $opts = [])
$originobject | string
$classstringthe class to build an instance of
$opts = []arrayconstructor arguments/options
Membres hérités (16)
PropriétésDéclaré parDescription
ListenersEvent
originEvent
returnValueSignal
MéthodesDéclaré parDescription
AddListener($handler, $order)EventRegister a listener directly (as opposed to ConnectListeners's attribute-based discovery).
ConnectListeners($obj)EventScan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class.
DisconnectListeners($obj)EventUndo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class.
dispatch()EventInvoke every GetListeners listener with $this.
GetListeners()EventCollect 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)EventRemove the last added handler from the listeners.
Send($args)EventConstruct a new instance of this class with $args, then dispatch it to every listener.
SetListenerOrder($handler, $order)EventChange 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