Added \TgBotLib\Objects > VideoChatParticipantsInvited
This commit is contained in:
parent
223baa8fa1
commit
8926b42dca
1 changed files with 45 additions and 0 deletions
45
src/TgBotLib/Objects/VideoChatParticipantsInvited.php
Normal file
45
src/TgBotLib/Objects/VideoChatParticipantsInvited.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects;
|
||||
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class VideoChatParticipantsInvited implements ObjectTypeInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var User[]
|
||||
*/
|
||||
private $users;
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'users' => array_map(function (User $user) {
|
||||
return $user->toArray();
|
||||
}, $this->users),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from an array representation
|
||||
*
|
||||
* @param array $data
|
||||
* @return ObjectTypeInterface
|
||||
*/
|
||||
public static function fromArray(array $data): ObjectTypeInterface
|
||||
{
|
||||
$object = new self();
|
||||
$object->users = array_map(function (array $user) {
|
||||
return User::fromArray($user);
|
||||
}, $data['users']);
|
||||
return $object;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue