From 7623f488eeb0c2b09b7bc2d92cf8649c4bedeee6 Mon Sep 17 00:00:00 2001 From: netkas Date: Sun, 3 Nov 2024 18:25:42 -0500 Subject: [PATCH] Rename UpdateEventType to EventType for consistency --- src/TgBotLib/Abstracts/UpdateEvent.php | 8 +-- src/TgBotLib/Bot.php | 10 ++-- src/TgBotLib/Classes/Utilities.php | 2 +- .../{UpdateEventType.php => EventType.php} | 54 +++++++++---------- .../Events/BusinessConnectionEvent.php | 6 +-- src/TgBotLib/Events/BusinessMessageEvent.php | 6 +-- src/TgBotLib/Events/CallbackQueryEvent.php | 6 +-- src/TgBotLib/Events/ChannelPostEvent.php | 6 +-- src/TgBotLib/Events/ChatBoostEvent.php | 6 +-- src/TgBotLib/Events/ChatJoinRequestEvent.php | 6 +-- .../Events/ChatMemberUpdatedEvent.php | 6 +-- .../Events/ChosenInlineResultEvent.php | 6 +-- .../Events/DeletedBusinessMessagesEvent.php | 6 +-- .../Events/EditedBusinessMessageEvent.php | 6 +-- .../Events/EditedChannelPostEvent.php | 6 +-- src/TgBotLib/Events/EditedMessageEvent.php | 6 +-- src/TgBotLib/Events/InlineQueryEvent.php | 6 +-- src/TgBotLib/Events/MessageEvent.php | 6 +-- .../Events/MessageReactionCountEvent.php | 6 +-- src/TgBotLib/Events/MessageReactionEvent.php | 6 +-- .../Events/MyChatMemberUpdatedEvent.php | 6 +-- .../Events/PaidMediaPurchasedEvent.php | 6 +-- src/TgBotLib/Events/PollAnswerEvent.php | 6 +-- src/TgBotLib/Events/PollEvent.php | 6 +-- src/TgBotLib/Events/PreCheckoutQueryEvent.php | 6 +-- src/TgBotLib/Events/RemovedChatBoostEvent.php | 6 +-- src/TgBotLib/Events/ShippingQueryEvent.php | 6 +-- src/TgBotLib/PollingBot.php | 8 +-- 28 files changed, 110 insertions(+), 110 deletions(-) rename src/TgBotLib/Enums/{UpdateEventType.php => EventType.php} (75%) diff --git a/src/TgBotLib/Abstracts/UpdateEvent.php b/src/TgBotLib/Abstracts/UpdateEvent.php index eeefe6c..3b938ae 100644 --- a/src/TgBotLib/Abstracts/UpdateEvent.php +++ b/src/TgBotLib/Abstracts/UpdateEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Abstracts; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Update; abstract class UpdateEvent @@ -23,11 +23,11 @@ /** * Retrieves the event type. - * @return UpdateEventType The event type of the current instance. + * @return EventType The event type of the current instance. */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::UPDATE_EVENT; + return EventType::UPDATE_EVENT; } public abstract function handle(Bot $bot): void; diff --git a/src/TgBotLib/Bot.php b/src/TgBotLib/Bot.php index 3b7431e..40e1888 100644 --- a/src/TgBotLib/Bot.php +++ b/src/TgBotLib/Bot.php @@ -14,7 +14,7 @@ use TgBotLib\Abstracts\Method; use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Classes\Logger; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Enums\Methods; use TgBotLib\Enums\Types\ChatActionType; use TgBotLib\Enums\Types\ParseMode; @@ -271,10 +271,10 @@ /** * Retrieves all event handlers that match a specified event type. * - * @param UpdateEventType $type The event type to filter handlers by. + * @param EventType $type The event type to filter handlers by. * @return array An array of event handlers that handle the specified event type. */ - public function getEventHandlersByType(UpdateEventType $type): array + public function getEventHandlersByType(EventType $type): array { $results = []; /** @var UpdateEvent $eventHandler */ @@ -302,10 +302,10 @@ /** * Removes all event handlers of a specified type. * - * @param UpdateEventType $type The event type to filter handlers by. + * @param EventType $type The event type to filter handlers by. * @return void */ - public function removeEventHandlersByType(UpdateEventType $type): void + public function removeEventHandlersByType(EventType $type): void { $this->eventHandlers = array_filter($this->eventHandlers, function($eventHandler) use ($type) { diff --git a/src/TgBotLib/Classes/Utilities.php b/src/TgBotLib/Classes/Utilities.php index fb89b00..8055f2e 100644 --- a/src/TgBotLib/Classes/Utilities.php +++ b/src/TgBotLib/Classes/Utilities.php @@ -5,7 +5,7 @@ use Exception; use LogLib\Log; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Currency; use TgBotLib\Objects\Update; diff --git a/src/TgBotLib/Enums/UpdateEventType.php b/src/TgBotLib/Enums/EventType.php similarity index 75% rename from src/TgBotLib/Enums/UpdateEventType.php rename to src/TgBotLib/Enums/EventType.php index 09db5ac..f45d8ff 100644 --- a/src/TgBotLib/Enums/UpdateEventType.php +++ b/src/TgBotLib/Enums/EventType.php @@ -28,7 +28,7 @@ use TgBotLib\Events\ShippingQueryEvent; use TgBotLib\Objects\Update; - enum UpdateEventType : string + enum EventType : string { case UPDATE_EVENT = UpdateEvent::class; case REMOVED_CHAT_BOOST_EVENT = RemovedChatBoostEvent::class; @@ -59,125 +59,125 @@ * Determines the type of event based on the provided Update object. * * @param Update $update The update object containing event details. - * @return UpdateEventType The type of event detected from the update. + * @return EventType The type of event detected from the update. */ - public static function determineEventType(Update $update): UpdateEventType + public static function determineEventType(Update $update): EventType { if($update->getRemovedChatBoost() !== null) { - return UpdateEventType::REMOVED_CHAT_BOOST_EVENT; + return EventType::REMOVED_CHAT_BOOST_EVENT; } if($update->getChatBoost() !== null) { - return UpdateEventType::CHAT_BOOST_EVENT; + return EventType::CHAT_BOOST_EVENT; } if($update->getChatJoinRequest() !== null) { - return UpdateEventType::CHAT_JOIN_REQUEST_EVENT; + return EventType::CHAT_JOIN_REQUEST_EVENT; } if($update->getChatMember() !== null) { - return UpdateEventType::CHAT_MEMBER_UPDATED; + return EventType::CHAT_MEMBER_UPDATED; } if($update->getMyChatMember() !== null) { - return UpdateEventType::MY_CHAT_MEMBER_UPDATED; + return EventType::MY_CHAT_MEMBER_UPDATED; } if($update->getPollAnswer() !== null) { - return UpdateEventType::POLL_ANSWER; + return EventType::POLL_ANSWER; } if($update->getPoll() !== null) { - return UpdateEventType::POLL; + return EventType::POLL; } if($update->getPurchasedPaidMedia() !== null) { - return UpdateEventType::PAID_MEDIA_PURCHASED; + return EventType::PAID_MEDIA_PURCHASED; } if($update->getPreCheckoutQuery() !== null) { - return UpdateEventType::PRE_CHECKOUT_QUERY; + return EventType::PRE_CHECKOUT_QUERY; } if($update->getShippingQuery() !== null) { - return UpdateEventType::SHIPPING_QUERY; + return EventType::SHIPPING_QUERY; } if($update->getCallbackQuery() !== null) { - return UpdateEventType::CALLBACK_QUERY; + return EventType::CALLBACK_QUERY; } if($update->getChosenInlineResult() !== null) { - return UpdateEventType::CHOSEN_INLINE_RESULT; + return EventType::CHOSEN_INLINE_RESULT; } if($update->getInlineQuery() !== null) { - return UpdateEventType::INLINE_QUERY; + return EventType::INLINE_QUERY; } if($update->getMessageReactionCount() !== null) { - return UpdateEventType::MESSAGE_REACTION_COUNT; + return EventType::MESSAGE_REACTION_COUNT; } if($update->getMessageReaction() !== null) { - return UpdateEventType::MESSAGE_REACTION; + return EventType::MESSAGE_REACTION; } if($update->getDeletedBusinessMessages() !== null) { - return UpdateEventType::DELETED_BUSINESS_MESSAGES; + return EventType::DELETED_BUSINESS_MESSAGES; } if($update->getEditedBusinessMessage() !== null) { - return UpdateEventType::EDITED_BUSINESS_MESSAGE; + return EventType::EDITED_BUSINESS_MESSAGE; } if($update->getBusinessMessage() !== null) { - return UpdateEventType::BUSINESS_MESSAGE; + return EventType::BUSINESS_MESSAGE; } if($update->getBusinessConnection() !== null) { - return UpdateEventType::BUSINESS_CONNECTION; + return EventType::BUSINESS_CONNECTION; } if($update->getEditedChannelPost() !== null) { - return UpdateEventType::EDITED_CHANNEL_POST; + return EventType::EDITED_CHANNEL_POST; } if($update->getChannelPost() !== null) { - return UpdateEventType::CHANNEL_POST; + return EventType::CHANNEL_POST; } if($update->getEditedMessage() !== null) { - return UpdateEventType::EDITED_MESSAGE; + return EventType::EDITED_MESSAGE; } if($update->getMessage() !== null) { - return UpdateEventType::MESSAGE; + return EventType::MESSAGE; } - return UpdateEventType::UPDATE_EVENT; + return EventType::UPDATE_EVENT; } } diff --git a/src/TgBotLib/Events/BusinessConnectionEvent.php b/src/TgBotLib/Events/BusinessConnectionEvent.php index f5fcfc8..53f2b47 100644 --- a/src/TgBotLib/Events/BusinessConnectionEvent.php +++ b/src/TgBotLib/Events/BusinessConnectionEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\BusinessConnection; abstract class BusinessConnectionEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::BUSINESS_CONNECTION; + return EventType::BUSINESS_CONNECTION; } /** diff --git a/src/TgBotLib/Events/BusinessMessageEvent.php b/src/TgBotLib/Events/BusinessMessageEvent.php index 5e8b6a1..d831aad 100644 --- a/src/TgBotLib/Events/BusinessMessageEvent.php +++ b/src/TgBotLib/Events/BusinessMessageEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Message; abstract class BusinessMessageEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::BUSINESS_MESSAGE; + return EventType::BUSINESS_MESSAGE; } /** diff --git a/src/TgBotLib/Events/CallbackQueryEvent.php b/src/TgBotLib/Events/CallbackQueryEvent.php index f01d21c..368bef7 100644 --- a/src/TgBotLib/Events/CallbackQueryEvent.php +++ b/src/TgBotLib/Events/CallbackQueryEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\CallbackQuery; abstract class CallbackQueryEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::CALLBACK_QUERY; + return EventType::CALLBACK_QUERY; } /** diff --git a/src/TgBotLib/Events/ChannelPostEvent.php b/src/TgBotLib/Events/ChannelPostEvent.php index dd257c3..8f90aee 100644 --- a/src/TgBotLib/Events/ChannelPostEvent.php +++ b/src/TgBotLib/Events/ChannelPostEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Message; abstract class ChannelPostEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::CHANNEL_POST; + return EventType::CHANNEL_POST; } /** diff --git a/src/TgBotLib/Events/ChatBoostEvent.php b/src/TgBotLib/Events/ChatBoostEvent.php index 685a16c..a15ff5b 100644 --- a/src/TgBotLib/Events/ChatBoostEvent.php +++ b/src/TgBotLib/Events/ChatBoostEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\ChatBoostUpdated; abstract class ChatBoostEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::CHAT_BOOST_EVENT; + return EventType::CHAT_BOOST_EVENT; } /** diff --git a/src/TgBotLib/Events/ChatJoinRequestEvent.php b/src/TgBotLib/Events/ChatJoinRequestEvent.php index 2efca36..034603c 100644 --- a/src/TgBotLib/Events/ChatJoinRequestEvent.php +++ b/src/TgBotLib/Events/ChatJoinRequestEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\ChatJoinRequest; abstract class ChatJoinRequestEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::CHAT_JOIN_REQUEST_EVENT; + return EventType::CHAT_JOIN_REQUEST_EVENT; } /** diff --git a/src/TgBotLib/Events/ChatMemberUpdatedEvent.php b/src/TgBotLib/Events/ChatMemberUpdatedEvent.php index 08d1222..ad4f11e 100644 --- a/src/TgBotLib/Events/ChatMemberUpdatedEvent.php +++ b/src/TgBotLib/Events/ChatMemberUpdatedEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\ChatMemberUpdated; abstract class ChatMemberUpdatedEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::CHAT_MEMBER_UPDATED; + return EventType::CHAT_MEMBER_UPDATED; } /** diff --git a/src/TgBotLib/Events/ChosenInlineResultEvent.php b/src/TgBotLib/Events/ChosenInlineResultEvent.php index 5687fe1..2fcad26 100644 --- a/src/TgBotLib/Events/ChosenInlineResultEvent.php +++ b/src/TgBotLib/Events/ChosenInlineResultEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Inline\ChosenInlineResult; abstract class ChosenInlineResultEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateeventType::CHOSEN_INLINE_RESULT; + return EventType::CHOSEN_INLINE_RESULT; } /** diff --git a/src/TgBotLib/Events/DeletedBusinessMessagesEvent.php b/src/TgBotLib/Events/DeletedBusinessMessagesEvent.php index e20d324..7e3b204 100644 --- a/src/TgBotLib/Events/DeletedBusinessMessagesEvent.php +++ b/src/TgBotLib/Events/DeletedBusinessMessagesEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\BusinessMessagesDeleted; abstract class DeletedBusinessMessagesEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::DELETED_BUSINESS_MESSAGES; + return EventType::DELETED_BUSINESS_MESSAGES; } /** diff --git a/src/TgBotLib/Events/EditedBusinessMessageEvent.php b/src/TgBotLib/Events/EditedBusinessMessageEvent.php index 9cb3975..f55abe9 100644 --- a/src/TgBotLib/Events/EditedBusinessMessageEvent.php +++ b/src/TgBotLib/Events/EditedBusinessMessageEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Message; abstract class EditedBusinessMessageEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::EDITED_BUSINESS_MESSAGE; + return EventType::EDITED_BUSINESS_MESSAGE; } /** diff --git a/src/TgBotLib/Events/EditedChannelPostEvent.php b/src/TgBotLib/Events/EditedChannelPostEvent.php index 67ff4a8..ac5bfb9 100644 --- a/src/TgBotLib/Events/EditedChannelPostEvent.php +++ b/src/TgBotLib/Events/EditedChannelPostEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Message; abstract class EditedChannelPostEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::EDITED_CHANNEL_POST; + return EventType::EDITED_CHANNEL_POST; } /** diff --git a/src/TgBotLib/Events/EditedMessageEvent.php b/src/TgBotLib/Events/EditedMessageEvent.php index 65d6e87..88fc592 100644 --- a/src/TgBotLib/Events/EditedMessageEvent.php +++ b/src/TgBotLib/Events/EditedMessageEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Message; abstract class EditedMessageEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::EDITED_MESSAGE; + return EventType::EDITED_MESSAGE; } /** diff --git a/src/TgBotLib/Events/InlineQueryEvent.php b/src/TgBotLib/Events/InlineQueryEvent.php index 86bd397..15dd0097 100644 --- a/src/TgBotLib/Events/InlineQueryEvent.php +++ b/src/TgBotLib/Events/InlineQueryEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Inline\InlineQuery; abstract class InlineQueryEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::INLINE_QUERY; + return EventType::INLINE_QUERY; } /**C diff --git a/src/TgBotLib/Events/MessageEvent.php b/src/TgBotLib/Events/MessageEvent.php index e2be5d1..321bb73 100644 --- a/src/TgBotLib/Events/MessageEvent.php +++ b/src/TgBotLib/Events/MessageEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Message; abstract class MessageEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::MESSAGE; + return EventType::MESSAGE; } /** diff --git a/src/TgBotLib/Events/MessageReactionCountEvent.php b/src/TgBotLib/Events/MessageReactionCountEvent.php index c8ccfb3..416b3ee 100644 --- a/src/TgBotLib/Events/MessageReactionCountEvent.php +++ b/src/TgBotLib/Events/MessageReactionCountEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\MessageReactionCountUpdated; abstract class MessageReactionCountEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::MESSAGE_REACTION_COUNT; + return EventType::MESSAGE_REACTION_COUNT; } /** diff --git a/src/TgBotLib/Events/MessageReactionEvent.php b/src/TgBotLib/Events/MessageReactionEvent.php index e7b88ec..3f7b84d 100644 --- a/src/TgBotLib/Events/MessageReactionEvent.php +++ b/src/TgBotLib/Events/MessageReactionEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\MessageReactionUpdated; abstract class MessageReactionEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::MESSAGE_REACTION; + return EventType::MESSAGE_REACTION; } /** diff --git a/src/TgBotLib/Events/MyChatMemberUpdatedEvent.php b/src/TgBotLib/Events/MyChatMemberUpdatedEvent.php index d60127f..bba6189 100644 --- a/src/TgBotLib/Events/MyChatMemberUpdatedEvent.php +++ b/src/TgBotLib/Events/MyChatMemberUpdatedEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\ChatMemberUpdated; abstract class MyChatMemberUpdatedEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::MY_CHAT_MEMBER_UPDATED; + return EventType::MY_CHAT_MEMBER_UPDATED; } /** diff --git a/src/TgBotLib/Events/PaidMediaPurchasedEvent.php b/src/TgBotLib/Events/PaidMediaPurchasedEvent.php index 58643f5..e64515f 100644 --- a/src/TgBotLib/Events/PaidMediaPurchasedEvent.php +++ b/src/TgBotLib/Events/PaidMediaPurchasedEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Payments\PaidMediaPurchased; abstract class PaidMediaPurchasedEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::PAID_MEDIA_PURCHASED; + return EventType::PAID_MEDIA_PURCHASED; } /** diff --git a/src/TgBotLib/Events/PollAnswerEvent.php b/src/TgBotLib/Events/PollAnswerEvent.php index 4c91fdc..4011622 100644 --- a/src/TgBotLib/Events/PollAnswerEvent.php +++ b/src/TgBotLib/Events/PollAnswerEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\PollAnswer; abstract class PollAnswerEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::POLL_ANSWER; + return EventType::POLL_ANSWER; } /** diff --git a/src/TgBotLib/Events/PollEvent.php b/src/TgBotLib/Events/PollEvent.php index b965f7b..2526df6 100644 --- a/src/TgBotLib/Events/PollEvent.php +++ b/src/TgBotLib/Events/PollEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Poll; abstract class PollEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::POLL; + return EventType::POLL; } /** diff --git a/src/TgBotLib/Events/PreCheckoutQueryEvent.php b/src/TgBotLib/Events/PreCheckoutQueryEvent.php index 8ae749d..8666be7 100644 --- a/src/TgBotLib/Events/PreCheckoutQueryEvent.php +++ b/src/TgBotLib/Events/PreCheckoutQueryEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Payments\PreCheckoutQuery; abstract class PreCheckoutQueryEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::PRE_CHECKOUT_QUERY; + return EventType::PRE_CHECKOUT_QUERY; } /** diff --git a/src/TgBotLib/Events/RemovedChatBoostEvent.php b/src/TgBotLib/Events/RemovedChatBoostEvent.php index 2ae20a5..e751360 100644 --- a/src/TgBotLib/Events/RemovedChatBoostEvent.php +++ b/src/TgBotLib/Events/RemovedChatBoostEvent.php @@ -3,7 +3,7 @@ namespace TgBotLib\Events; use TgBotLib\Abstracts\UpdateEvent; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\ChatBoostRemoved; abstract class RemovedChatBoostEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::REMOVED_CHAT_BOOST_EVENT; + return EventType::REMOVED_CHAT_BOOST_EVENT; } /** diff --git a/src/TgBotLib/Events/ShippingQueryEvent.php b/src/TgBotLib/Events/ShippingQueryEvent.php index 6bbe50a..c77d3f3 100644 --- a/src/TgBotLib/Events/ShippingQueryEvent.php +++ b/src/TgBotLib/Events/ShippingQueryEvent.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; use TgBotLib\Objects\Payments\ShippingQuery; abstract class ShippingQueryEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): UpdateEventType + public static function getEventType(): EventType { - return UpdateEventType::SHIPPING_QUERY; + return EventType::SHIPPING_QUERY; } /** diff --git a/src/TgBotLib/PollingBot.php b/src/TgBotLib/PollingBot.php index 3d2f2ff..52f9c81 100644 --- a/src/TgBotLib/PollingBot.php +++ b/src/TgBotLib/PollingBot.php @@ -4,7 +4,7 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Classes\Utilities; - use TgBotLib\Enums\UpdateEventType; + use TgBotLib\Enums\EventType; /** * PollingBot class that extends Bot for handling updates using polling. @@ -136,14 +136,14 @@ $this->offset = $update->getUpdateId() + 1; } - $updateByType = $this->getEventHandlersByType(UpdateEventType::determineEventType($update)); + $updateByType = $this->getEventHandlersByType(EventType::determineEventType($update)); if(count($updateByType) === 0) { // If no event handlers are found appropriate for the update type, use the generic update event handler // So that we don't miss any updates /** @var UpdateEvent $eventHandler */ - foreach($this->getEventHandlersByType(UpdateEventType::UPDATE_EVENT) as $eventHandler) + foreach($this->getEventHandlersByType(EventType::UPDATE_EVENT) as $eventHandler) { (new $eventHandler($update))->handle($this); } @@ -152,7 +152,7 @@ { // Otherwise, use the appropriate event handler for the update type /** @var UpdateEvent $eventHandler */ - foreach($this->getEventHandlersByType(UpdateEventType::determineEventType($update)) as $eventHandler) + foreach($this->getEventHandlersByType(EventType::determineEventType($update)) as $eventHandler) { (new $eventHandler($update))->handle($this); }