Updated WebhookInfo

This commit is contained in:
netkas 2024-10-06 16:09:07 -04:00
parent 7738851797
commit 3196c357f1

View file

@ -7,50 +7,15 @@
class WebhookInfo implements ObjectTypeInterface class WebhookInfo implements ObjectTypeInterface
{ {
/** private string $url;
* @var string private bool $has_custom_certificate;
*/ private int $pending_update_count;
private $url; private ?string $ip_address;
private ?int $last_error_date;
/** private ?string $last_error_message;
* @var bool private ?int $last_synchronization_error_date;
*/ private ?int $max_connections;
private $has_custom_certificate; private ?array $allowed_updates;
/**
* @var int
*/
private $pending_update_count;
/**
* @var string|null
*/
private $ip_address;
/**
* @var int|null
*/
private $last_error_date;
/**
* @var string|null
*/
private $last_error_message;
/**
* @var int|null
*/
private $last_synchronization_error_date;
/**
* @var int|null
*/
private $max_connections;
/**
* @var string[]|null
*/
private $allowed_updates;
/** /**
* Webhook URL, may be empty if webhook is not set up * Webhook URL, may be empty if webhook is not set up
@ -145,9 +110,7 @@
} }
/** /**
* Returns an array representation of the object * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -165,15 +128,16 @@
} }
/** /**
* Constructs the object from an array * @inheritDoc
*
* @param array $data
* @return WebhookInfo
*/ */
public static function fromArray(array $data): WebhookInfo public static function fromArray(?array $data): ?WebhookInfo
{ {
$object = new self(); if($data === null)
{
return null;
}
$object = new self();
$object->url = $data['url'] ?? null; $object->url = $data['url'] ?? null;
$object->has_custom_certificate = $data['has_custom_certificate'] ?? false; $object->has_custom_certificate = $data['has_custom_certificate'] ?? false;
$object->pending_update_count = $data['pending_update_count'] ?? false; $object->pending_update_count = $data['pending_update_count'] ?? false;