From 088eac6b88c38d31d248be010ffeebe861e70f92 Mon Sep 17 00:00:00 2001 From: netkas Date: Tue, 1 Oct 2024 12:41:46 -0400 Subject: [PATCH] Added ChatBackground --- .../Objects/Telegram/ChatBackground.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/TgBotLib/Objects/Telegram/ChatBackground.php diff --git a/src/TgBotLib/Objects/Telegram/ChatBackground.php b/src/TgBotLib/Objects/Telegram/ChatBackground.php new file mode 100644 index 0000000..1af8dae --- /dev/null +++ b/src/TgBotLib/Objects/Telegram/ChatBackground.php @@ -0,0 +1,46 @@ +type; + } + + /** + * @inheritDoc + */ + public function toArray(): array + { + return [ + 'type' => $this->type->toArray() + ]; + } + + /** + * @inheritDoc + */ + public static function fromArray(array $data): ObjectTypeInterface + { + if (!isset($data['type'])) + { + throw new InvalidArgumentException('ChatBackground expected type'); + } + + $object = new self(); + $object->type = BackgroundType::fromArray($data['type']); + return $object; + } +} \ No newline at end of file