CodeExplorer optimizeListeners example
if (__CLASS__ ===
static::
class) { $this->optimized =
[];
} } public function dispatch(object
$event, string
$eventName = null
): object
{ $eventName ??=
$event::
class;
if (isset($this->optimized
)) { $listeners =
$this->optimized
[$eventName] ?? (empty($this->listeners
[$eventName]) ?
[] :
$this->
optimizeListeners($eventName));
} else { $listeners =
$this->
getListeners($eventName);
} if ($listeners) { $this->
callListeners($listeners,
$eventName,
$event);
} return $event;
} if (__CLASS__ ===
static::
class) { $this->optimized =
[];
} } public function dispatch(object
$event, string
$eventName = null
): object
{ $eventName ??=
$event::
class;
if (isset($this->optimized
)) { $listeners =
$this->optimized
[$eventName] ?? (empty($this->listeners
[$eventName]) ?
[] :
$this->
optimizeListeners($eventName));
} else { $listeners =
$this->
getListeners($eventName);
} if ($listeners) { $this->
callListeners($listeners,
$eventName,
$event);
} return $event;
}