diff --git a/src/TgBotLib/Abstracts/UpdateEvent.php b/src/TgBotLib/Abstracts/UpdateEvent.php index 3b938ae..eeefe6c 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\EventType; + use TgBotLib\Enums\UpdateEventType; use TgBotLib\Objects\Update; abstract class UpdateEvent @@ -23,11 +23,11 @@ /** * Retrieves the event type. - * @return EventType The event type of the current instance. + * @return UpdateEventType The event type of the current instance. */ - public static function getEventType(): EventType + public static function getEventType(): UpdateEventType { - return EventType::UPDATE_EVENT; + return UpdateEventType::UPDATE_EVENT; } public abstract function handle(Bot $bot): void; diff --git a/src/TgBotLib/Bot.php b/src/TgBotLib/Bot.php index b044ea3..d1c4c6c 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\EventType; + use TgBotLib\Enums\UpdateEventType; 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 EventType $type The event type to filter handlers by. + * @param UpdateEventType $type The event type to filter handlers by. * @return array An array of event handlers that handle the specified event type. */ - public function getEventHandlersByType(EventType $type): array + public function getEventHandlersByType(UpdateEventType $type): array { $results = []; /** @var UpdateEvent $eventHandler */ @@ -302,10 +302,10 @@ /** * Removes all event handlers of a specified type. * - * @param EventType $type The event type to filter handlers by. + * @param UpdateEventType $type The event type to filter handlers by. * @return void */ - public function removeEventHandlersByType(EventType $type): void + public function removeEventHandlersByType(UpdateEventType $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 73a74e5..ab06a82 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\EventType; + use TgBotLib\Enums\UpdateEventType; use TgBotLib\Objects\Currency; use TgBotLib\Objects\Update; @@ -57,30 +57,30 @@ * Determines the type of event based on the provided update object. * * @param Update $update The update object containing event information. - * @return EventType The determined type of the event. + * @return UpdateEventType The determined type of the event. */ - public static function determineEventType(Update $update): EventType + public static function determineEventType(Update $update): UpdateEventType { if($update->getRemovedChatBoost() !== null) { - return EventType::REMOVED_CHAT_BOOST_EVENT; + return UpdateEventType::REMOVED_CHAT_BOOST_EVENT; } if($update->getChatBoost() !== null) { - return EventType::CHAT_BOOST_EVENT; + return UpdateEventType::CHAT_BOOST_EVENT; } if($update->getChatJoinRequest() !== null) { - return EventType::CHAT_JOIN_REQUEST_EVENT; + return UpdateEventType::CHAT_JOIN_REQUEST_EVENT; } if($update->getChatMember() !== null) { - return EventType::CHAT_MEMBER_UPDATED; + return UpdateEventType::CHAT_MEMBER_UPDATED; } - return EventType::UPDATE_EVENT; + return UpdateEventType::UPDATE_EVENT; } } \ No newline at end of file diff --git a/src/TgBotLib/Enums/EventType.php b/src/TgBotLib/Enums/UpdateEventType.php similarity index 94% rename from src/TgBotLib/Enums/EventType.php rename to src/TgBotLib/Enums/UpdateEventType.php index 1d56c62..6e5532c 100644 --- a/src/TgBotLib/Enums/EventType.php +++ b/src/TgBotLib/Enums/UpdateEventType.php @@ -8,7 +8,7 @@ use TgBotLib\Events\ChatMemberUpdatedEvent; use TgBotLib\Events\RemovedChatBoostEvent; - enum EventType : string + enum UpdateEventType : string { case UPDATE_EVENT = UpdateEvent::class; case REMOVED_CHAT_BOOST_EVENT = RemovedChatBoostEvent::class; diff --git a/src/TgBotLib/Events/ChatBoostEvent.php b/src/TgBotLib/Events/ChatBoostEvent.php index 0eeb631..0a87d41 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\EventType; + use TgBotLib\Enums\UpdateEventType; use TgBotLib\Objects\ChatBoostUpdated; abstract class ChatBoostEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): EventType + public static function getEventType(): UpdateEventType { - return EventType::CHAT_BOOST_EVENT; + return UpdateEventType::CHAT_BOOST_EVENT; } /** diff --git a/src/TgBotLib/Events/ChatJoinRequestEvent.php b/src/TgBotLib/Events/ChatJoinRequestEvent.php index fe041bd..599042c 100644 --- a/src/TgBotLib/Events/ChatJoinRequestEvent.php +++ b/src/TgBotLib/Events/ChatJoinRequestEvent.php @@ -4,14 +4,14 @@ use TgBotLib\Abstracts\UpdateEvent; use TgBotLib\Bot; - use TgBotLib\Enums\EventType; + use TgBotLib\Enums\UpdateEventType; use TgBotLib\Objects\ChatJoinRequest; abstract class ChatJoinRequestEvent extends UpdateEvent { - public static function getEventType(): EventType + public static function getEventType(): UpdateEventType { - return EventType::CHAT_JOIN_REQUEST_EVENT; + return UpdateEventType::CHAT_JOIN_REQUEST_EVENT; } /** diff --git a/src/TgBotLib/Events/ChatMemberUpdatedEvent.php b/src/TgBotLib/Events/ChatMemberUpdatedEvent.php index 6872bf5..cb1c62d 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\EventType; + use TgBotLib\Enums\UpdateEventType; use TgBotLib\Objects\ChatMemberUpdated; abstract class ChatMemberUpdatedEvent extends UpdateEvent @@ -12,9 +12,9 @@ /** * @inheritDoc */ - public static function getEventType(): EventType + public static function getEventType(): UpdateEventType { - return EventType::CHAT_MEMBER_UPDATED; + return UpdateEventType::CHAT_MEMBER_UPDATED; } /** diff --git a/src/TgBotLib/Events/RemovedChatBoostEvent.php b/src/TgBotLib/Events/RemovedChatBoostEvent.php index 4b86d13..5910a77 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\EventType; + use TgBotLib\Enums\UpdateEventType; use TgBotLib\Objects\ChatBoostRemoved; abstract class RemovedChatBoostEvent extends UpdateEvent @@ -11,9 +11,9 @@ /** * @inheritDoc */ - public static function getEventType(): EventType + public static function getEventType(): UpdateEventType { - return EventType::REMOVED_CHAT_BOOST_EVENT; + return UpdateEventType::REMOVED_CHAT_BOOST_EVENT; } /** diff --git a/src/TgBotLib/PollingBot.php b/src/TgBotLib/PollingBot.php index 0fc062e..da2534e 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\EventType; + use TgBotLib\Enums\UpdateEventType; use TgBotLib\Objects\Update; class PollingBot extends Bot