Updated Messages
This commit is contained in:
parent
6280b8c026
commit
4558409da5
3 changed files with 18 additions and 5 deletions
|
@ -44,10 +44,14 @@ class InaccessibleMessage extends MaybeInaccessibleMessage implements ObjectType
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): InaccessibleMessage
|
||||
public static function fromArray(?array $data): ?InaccessibleMessage
|
||||
{
|
||||
$object = new self();
|
||||
if($data === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$object = new self();
|
||||
$object->chat = isset($data['chat']) ? Chat::fromArray($data['chat']) : null;
|
||||
$object->message_id = $data['message_id'];
|
||||
$object->date = $data['data'];
|
||||
|
|
|
@ -27,8 +27,13 @@ abstract class MaybeInaccessibleMessage implements ObjectTypeInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): MaybeInaccessibleMessage
|
||||
public static function fromArray(?array $data): ?MaybeInaccessibleMessage
|
||||
{
|
||||
if($data === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!isset($data['date']))
|
||||
{
|
||||
throw new InvalidArgumentException('Expected date in message');
|
||||
|
|
|
@ -1088,10 +1088,14 @@
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): Message
|
||||
public static function fromArray(?array $data): ?Message
|
||||
{
|
||||
$object = new self();
|
||||
if($data === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$object = new self();
|
||||
$object->message_id = $data['message_id'];
|
||||
$object->message_thread_id = $data['message_thread_id'] ?? null;
|
||||
$object->from = isset($data['from']) ? User::fromArray($data['from']) : null;
|
||||
|
|
Loading…
Add table
Reference in a new issue