From 1c2363eca609bd8581288bb4d0f54ddb750aaf39 Mon Sep 17 00:00:00 2001 From: Netkas Date: Mon, 13 Feb 2023 20:12:13 -0500 Subject: [PATCH] Added \TgBotLib\Objects > BotCommand --- src/TgBotLib/Objects/BotCommand.php | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/TgBotLib/Objects/BotCommand.php diff --git a/src/TgBotLib/Objects/BotCommand.php b/src/TgBotLib/Objects/BotCommand.php new file mode 100644 index 0000000..27c6b21 --- /dev/null +++ b/src/TgBotLib/Objects/BotCommand.php @@ -0,0 +1,69 @@ +command; + } + + /** + * Description of the command; 1-256 characters. + * + * @return string + */ + public function getDescription(): string + { + return $this->description; + } + + /** + * Returns an array representation of the object + * + * @return array + */ + public function toArray(): array + { + return [ + 'command' => $this->command, + 'description' => $this->description, + ]; + } + + /** + * Constructs object from an array representation + * + * @param array $data + * @return ObjectTypeInterface + */ + public static function fromArray(array $data): ObjectTypeInterface + { + $object = new self(); + + $object->command = $data['command']; + $object->description = $data['description']; + + return $object; + } + } \ No newline at end of file