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