From 29bc2813199940a6dfcec45e74226268d8c5b9d7 Mon Sep 17 00:00:00 2001 From: Netkas Date: Sun, 12 Feb 2023 17:24:05 -0500 Subject: [PATCH] Updated \TgBotLib\Objects > PollOption --- src/TgBotLib/Objects/PollOption.php | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/TgBotLib/Objects/PollOption.php diff --git a/src/TgBotLib/Objects/PollOption.php b/src/TgBotLib/Objects/PollOption.php new file mode 100644 index 0000000..abf5cc4 --- /dev/null +++ b/src/TgBotLib/Objects/PollOption.php @@ -0,0 +1,69 @@ +text; + } + + /** + * Number of users that voted for this option + * + * @return int + */ + public function getVoterCount(): int + { + return $this->voter_count; + } + + /** + * Returns an array representation of the object + * + * @return array + */ + public function toArray(): array + { + return [ + 'text' => $this->text, + 'voter_count' => $this->voter_count, + ]; + } + + /** + * Constructs an object from an array representation + * + * @param array $data + * @return ObjectTypeInterface + */ + public static function fromArray(array $data): ObjectTypeInterface + { + $object = new self(); + + $object->text = $data['text']; + $object->voter_count = $data['voter_count']; + + return $object; + } + } \ No newline at end of file