Fix object instantiation and add getUpdate functionality
This commit is contained in:
parent
845a0d3b3c
commit
f2f26998ad
6 changed files with 57 additions and 12 deletions
|
@ -1142,7 +1142,7 @@
|
|||
$object->poll = isset($data['poll']) ? Poll::fromArray($data['poll']) : null;
|
||||
$object->venue = isset($data['venue']) ? Venue::fromArray($data['venue']) : null;
|
||||
$object->location = isset($data['location']) ? Location::fromArray($data['location']) : null;
|
||||
$object->new_chat_members = isset($data['new_chat_members']) ? array_map(fn($item) => User::fromArray($data), $data['new_chat_members']) : null;
|
||||
$object->new_chat_members = isset($data['new_chat_members']) ? array_map(fn($item) => User::fromArray($item), $data['new_chat_members']) : null;
|
||||
$object->left_chat_member = isset($data['left_chat_member']) ? User::fromArray($data['left_chat_member']) : null;
|
||||
$object->new_chat_title = $data['new_chat_title'] ?? null;
|
||||
$object->new_chat_photo = isset($data['new_chat_photo']) ? array_map(fn($item) => PhotoSize::fromArray($data), $data['new_chat_photo']): null;
|
||||
|
|
|
@ -331,7 +331,8 @@
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(?array $data): ?Update
|
||||
public static function
|
||||
fromArray(?array $data): ?Update
|
||||
{
|
||||
if($data === null)
|
||||
{
|
||||
|
|
|
@ -187,15 +187,10 @@
|
|||
*/
|
||||
public static function fromArray(?array $data): ?User
|
||||
{
|
||||
if($data === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$object = new self();
|
||||
$object->id = $data['id'] ?? null;
|
||||
$object->id = $data['id'];
|
||||
$object->is_bot = $data['is_bot'] ?? false;
|
||||
$object->first_name = $data['first_name'] ?? null;
|
||||
$object->first_name = $data['first_name'];
|
||||
$object->last_name = $data['last_name'] ?? null;
|
||||
$object->username = $data['username'] ?? null;
|
||||
$object->language_code = $data['language_code'] ?? null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue