/var/www/vhosts/ihelp.ro/httpdocs/vendor/mirko-pagliai/php-tools/src/Event
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/mirko-pagliai/php-tools/src/Event/EventDispatcherTrait.php (1788B)
EventDispatcher ??= new EventDispatcher();
}
/**
* Sets a new `EventDispatcher`
* @param \Tools\Event\EventDispatcher $eventDispatcher Event dispatcher
* @return $this
* @noinspection PhpMissingReturnTypeInspection
*/
public function setEventDispatcher(EventDispatcher $eventDispatcher)
{
$this->EventDispatcher = $eventDispatcher;
return $this;
}
/**
* Dispatches an event
* @param string $name Name of the event
* @param mixed $args Any event argument you wish to be transported with
* this event to it can be read by listeners
* @return \Tools\Event\Event
*/
public function dispatchEvent(string $name, $args = null): Event
{
$event = new Event($name, $args);
$this->getEventDispatcher()->dispatch($event, $name);
return $event;
}
}