Updated LoginUrl

This commit is contained in:
netkas 2024-10-05 00:30:16 -04:00
parent b2c8877294
commit 26162a1a7c

View file

@ -7,25 +7,10 @@
class LoginUrl implements ObjectTypeInterface class LoginUrl implements ObjectTypeInterface
{ {
/** private string $url;
* @var string private ?string $forward_text;
*/ private ?string $bot_username;
private $url; private bool $request_write_access;
/**
* @var string|null
*/
private $forward_text;
/**
* @var string|null
*/
private $bot_username;
/**
* @var bool
*/
private $request_write_access;
/** /**
* An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. * An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed.
@ -75,9 +60,7 @@
} }
/** /**
* Returns an array representation of the object * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -90,15 +73,16 @@
} }
/** /**
* Constructs the object from an array representation * @inheritDoc
*
* @param array $data
* @return LoginUrl
*/ */
public static function fromArray(array $data): self public static function fromArray(?array $data): LoginUrl
{ {
$object = new self(); if($data === null)
{
$data = [];
}
$object = new self();
$object->url = $data['url'] ?? null; $object->url = $data['url'] ?? null;
$object->forward_text = $data['forward_text'] ?? null; $object->forward_text = $data['forward_text'] ?? null;
$object->bot_username = $data['bot_username'] ?? null; $object->bot_username = $data['bot_username'] ?? null;