Skip to content

Commit

Permalink
Skip event trigger if no events are registered
Browse files Browse the repository at this point in the history
  • Loading branch information
juniwalk authored Aug 19, 2024
1 parent d528f82 commit 9017c24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Traits/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ protected function trigger(string $event, mixed ...$args): void
{
$event = Format::kebabCase($event);

if (empty($this->events[$event] ?? [])) {
return;
}

ksort($this->events[$event], SORT_NUMERIC);

foreach ($this->events[$event] as $handler) {
Expand Down

0 comments on commit 9017c24

Please sign in to comment.