From 00066a9a7d6c4c3c44253de666b5e0ba4ea469a3 Mon Sep 17 00:00:00 2001 From: Netkas Date: Mon, 13 Feb 2023 20:10:34 -0500 Subject: [PATCH] Added \TgBotLib\Objects > ForumTopic --- src/TgBotLib/Objects/ForumTopic.php | 103 ++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 src/TgBotLib/Objects/ForumTopic.php diff --git a/src/TgBotLib/Objects/ForumTopic.php b/src/TgBotLib/Objects/ForumTopic.php new file mode 100644 index 0000000..763bd3a --- /dev/null +++ b/src/TgBotLib/Objects/ForumTopic.php @@ -0,0 +1,103 @@ +message_thread_id; + } + + /** + * Name of the topic + * + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * Color of the topic icon in RGB format + * + * @return int + */ + public function getIconColor(): int + { + return $this->icon_color; + } + + /** + * Optional. Unique identifier of the custom emoji shown as the topic icon + * + * @return string|null + */ + public function getIconCustomEmojiId(): ?string + { + return $this->icon_custom_emoji_id; + } + + /** + * Returns an array representation of the object + * + * @return array + */ + public function toArray(): array + { + return [ + 'message_thread_id' => $this->message_thread_id, + 'name' => $this->name, + 'icon_color' => $this->icon_color, + 'icon_custom_emoji_id' => $this->icon_custom_emoji_id, + ]; + } + + /** + * Constructs object from an array representation + * + * @param array $data + * @return ObjectTypeInterface + */ + public static function fromArray(array $data): ObjectTypeInterface + { + $object = new self(); + + $object->message_thread_id = $data['message_thread_id']; + $object->name = $data['name']; + $object->icon_color = $data['icon_color']; + $object->icon_custom_emoji_id = @$data['icon_custom_emoji_id'] ?: null; + + return $object; + } + } \ No newline at end of file