Updated InputMessageContent objects

This commit is contained in:
netkas 2024-10-04 00:14:47 -04:00
parent 9dd11af87d
commit aaacd8851e
5 changed files with 30 additions and 9 deletions

View file

@ -159,10 +159,14 @@
/** /**
* @inheritDoc * @inheritDoc
*/ */
public static function fromArray(array $data): InputContactMessageContent public static function fromArray(?array $data): ?InputContactMessageContent
{ {
$object = new self(); if($data === null)
{
return null;
}
$object = new self();
$object->type = InputMessageContentType::CONTACT; $object->type = InputMessageContentType::CONTACT;
$object->phone_number = $data['phone_number'] ?? null; $object->phone_number = $data['phone_number'] ?? null;
$object->first_name = $data['first_name'] ?? null; $object->first_name = $data['first_name'] ?? null;

View file

@ -609,10 +609,14 @@
/** /**
* @inheritDoc * @inheritDoc
*/ */
public static function fromArray(array $data): InputInvoiceMessageContent public static function fromArray(?array $data): ?InputInvoiceMessageContent
{ {
$object = new self(); if($data === null)
{
return null;
}
$object = new self();
$object->type = InputMessageContentType::INVOICE; $object->type = InputMessageContentType::INVOICE;
$object->title = $data['title'] ?? null; $object->title = $data['title'] ?? null;
$object->description = $data['description'] ?? null; $object->description = $data['description'] ?? null;

View file

@ -217,10 +217,14 @@
/** /**
* @inheritDoc * @inheritDoc
*/ */
public static function fromArray(array $data): InputLocationMessageContent public static function fromArray(?array $data): ?InputLocationMessageContent
{ {
$object = new self(); if($data === null)
{
return null;
}
$object = new self();
$object->type = InputMessageContentType::LOCATION; $object->type = InputMessageContentType::LOCATION;
$object->latitude = (float)$data['latitude'] ?? null; $object->latitude = (float)$data['latitude'] ?? null;
$object->longitude = (float)$data['longitude'] ?? null; $object->longitude = (float)$data['longitude'] ?? null;

View file

@ -179,10 +179,14 @@
/** /**
* @inheritDoc * @inheritDoc
*/ */
public static function fromArray(array $data): InputTextMessageContent public static function fromArray(?array $data): ?InputTextMessageContent
{ {
$object = new self(); if($data === null)
{
return null;
}
$object = new self();
$object->type = InputMessageContentType::TEXT; $object->type = InputMessageContentType::TEXT;
$object->message_text = $data['message_text'] ?? null; $object->message_text = $data['message_text'] ?? null;
$object->parse_mode = $data['parse_mode'] ?? null; $object->parse_mode = $data['parse_mode'] ?? null;

View file

@ -227,8 +227,13 @@
/** /**
* @inheritDoc * @inheritDoc
*/ */
public static function fromArray(array $data): InputVenueMessageContent public static function fromArray(?array $data): ?InputVenueMessageContent
{ {
if($data === null)
{
return null;
}
$object = new self(); $object = new self();
$object->type = InputMessageContentType::VENUE; $object->type = InputMessageContentType::VENUE;
$object->latitude = (float)$data['latitude'] ?? null; $object->latitude = (float)$data['latitude'] ?? null;