foreach ($events as $class) { $definition =
$this->
define($class);
if (!
$definition) { continue;
} $result->
set($definition->
getName(),
$definition);
} // allows to mutate different events by plugins
$event =
new BusinessEventCollectorEvent($result,
$context);
$this->eventDispatcher->
dispatch($event, BusinessEventCollectorEvent::NAME
);
$result =
$event->
getCollection();
$result->
sort(fn (BusinessEventDefinition
$a, BusinessEventDefinition
$b) =>
$a->
getName() <=>
$b->
getName());
return $result;
} /**
* @param class-string $class
*/