Refactor event type determination logic

This commit is contained in:
netkas 2024-11-03 17:22:45 -05:00
parent 4829853d0e
commit 56c7fb04d2
4 changed files with 159 additions and 123 deletions

View file

@ -136,7 +136,7 @@
$this->offset = $update->getUpdateId() + 1;
}
$updateByType = $this->getEventHandlersByType(Utilities::determineEventType($update));
$updateByType = $this->getEventHandlersByType(UpdateEventType::determineEventType($update));
if(count($updateByType) === 0)
{
@ -152,7 +152,7 @@
{
// Otherwise, use the appropriate event handler for the update type
/** @var UpdateEvent $eventHandler */
foreach($this->getEventHandlersByType(Utilities::determineEventType($update)) as $eventHandler)
foreach($this->getEventHandlersByType(UpdateEventType::determineEventType($update)) as $eventHandler)
{
(new $eventHandler($update))->handle($this);
}