public function triggerAndCount($name, ...$args)
{
if ($this->addThisToEvents) {
array_unshift($args, $this);
}
$cnt = 0;
if (isset($this->eventHandlers[$name])) {
$this->lastEventName = $name;
foreach ($this->eventHandlers[$name] as $cb) {
if ($cb(...$args) !== 0) {
++$cnt;
}
}
}
return $cnt;
}