PHPDaemon\Traits\EventHandlers::trigger PHP Method

trigger() public method

Propagate event
public trigger ( string $name, $args ) : this
$name string Event name
$args Arguments
return this
    public function trigger($name, ...$args)
    {
        if ($this->addThisToEvents) {
            array_unshift($args, $this);
        }
        if (isset($this->eventHandlers[$name])) {
            $this->lastEventName = $name;
            foreach ($this->eventHandlers[$name] as $cb) {
                if ($cb(...$args) === true) {
                    return $this;
                }
            }
        }
        return $this;
    }