From 40816a586f8cf9f9d6d50f01e0c3b051528d63c9 Mon Sep 17 00:00:00 2001 From: netkas Date: Sun, 6 Oct 2024 16:03:52 -0400 Subject: [PATCH] Updated VideoChatParticipantsInvited --- .../Objects/VideoChatParticipantsInvited.php | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/TgBotLib/Objects/VideoChatParticipantsInvited.php b/src/TgBotLib/Objects/VideoChatParticipantsInvited.php index 919052e..2b89501 100644 --- a/src/TgBotLib/Objects/VideoChatParticipantsInvited.php +++ b/src/TgBotLib/Objects/VideoChatParticipantsInvited.php @@ -10,34 +10,47 @@ /** * @var User[] */ - private $users; + private array $users; /** - * Returns an array representation of the object + * New members that were invited to the video chat * - * @return array + * @return User[] + */ + public function getUsers(): array + { + return $this->users; + } + + /** + * @inheritDoc */ public function toArray(): array { return [ - 'users' => array_map(function (User $user) { + 'users' => array_map(function (User $user) + { return $user->toArray(); }, $this->users), ]; } /** - * Constructs object from an array representation - * - * @param array $data - * @return VideoChatParticipantsInvited + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(?array $data): ?VideoChatParticipantsInvited { + if($data === null) + { + return null; + } + $object = new self(); - $object->users = array_map(function (array $user) { + $object->users = array_map(function (array $user) + { return User::fromArray($user); }, $data['users']); + return $object; } } \ No newline at end of file