From 22f28c5711f7a28bf13f39809237d245b4162e9d Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 9 Oct 2024 13:13:15 -0400 Subject: [PATCH] Added UserChatBoosts --- src/TgBotLib/Objects/UserChatBoosts.php | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/TgBotLib/Objects/UserChatBoosts.php diff --git a/src/TgBotLib/Objects/UserChatBoosts.php b/src/TgBotLib/Objects/UserChatBoosts.php new file mode 100644 index 0000000..8b4e042 --- /dev/null +++ b/src/TgBotLib/Objects/UserChatBoosts.php @@ -0,0 +1,49 @@ +boosts; + } + + /** + * @inheritDoc + */ + public function toArray(): ?array + { + return [ + 'boosts' => array_map(fn(ChatBoost $item) => $item->toArray(), $this->boosts) + ]; + } + + /** + * @inheritDoc + */ + public static function fromArray(?array $data): ?UserChatBoosts + { + if($data === null) + { + return null; + } + + $object = new self(); + $object->boosts = array_map(fn(array $item) => ChatBoost::fromArray($item), $data['boosts']); + + return $object; + } + } \ No newline at end of file