Updated InlineKeyboardButton

This commit is contained in:
netkas 2024-10-05 00:17:34 -04:00
parent 4558409da5
commit d56654a512

View file

@ -10,50 +10,15 @@
class InlineKeyboardButton implements ObjectTypeInterface class InlineKeyboardButton implements ObjectTypeInterface
{ {
/** private string $text;
* @var string private ?string $url;
*/ private ?string $callback_data;
private $text; private ?WebAppInfo $web_app;
private ?LoginUrl $login_url;
/** private ?string $switch_inline_query;
* @var string|null private ?string $switch_inline_query_current_chat;
*/ private ?CallbackGame $callback_game;
private $url; private bool $pay;
/**
* @var string|null
*/
private $callback_data;
/**
* @var WebAppInfo|null
*/
private $web_app;
/**
* @var LoginUrl|null
*/
private $login_url;
/**
* @var string|null
*/
private $switch_inline_query;
/**
* @var string|null
*/
private $switch_inline_query_current_chat;
/**
* @var CallbackGame|null
*/
private $callback_game;
/**
* @var bool
*/
private $pay;
/** /**
* Label text on the button * Label text on the button
@ -309,9 +274,7 @@
} }
/** /**
* Returns an array representation of the object * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -319,20 +282,17 @@
'text' => $this->text ?? null, 'text' => $this->text ?? null,
'url' => $this->url ?? null, 'url' => $this->url ?? null,
'callback_data' => $this->callback_data ?? null, 'callback_data' => $this->callback_data ?? null,
'web_app' => ($this->web_app instanceof ObjectTypeInterface) ? $this->web_app->toArray() : null, 'web_app' => $this->web_app?->toArray(),
'login_url' => ($this->login_url instanceof ObjectTypeInterface) ? $this->login_url->toArray() : null, 'login_url' => $this->login_url?->toArray(),
'switch_inline_query' => $this->switch_inline_query ?? null, 'switch_inline_query' => $this->switch_inline_query ?? null,
'switch_inline_query_current_chat' => $this->switch_inline_query_current_chat ?? null, 'switch_inline_query_current_chat' => $this->switch_inline_query_current_chat ?? null,
'callback_game' => ($this->callback_game instanceof ObjectTypeInterface) ? $this->callback_game->toArray() : null, 'callback_game' => $this->callback_game?->toArray(),
'pay' => $this->pay ?? null 'pay' => $this->pay ?? null
]; ];
} }
/** /**
* Constructs a new InlineKeyboardButton object from an array * @inheritDoc
*
* @param array|null $data
* @return InlineKeyboardButton|null
*/ */
public static function fromArray(?array $data): ?InlineKeyboardButton public static function fromArray(?array $data): ?InlineKeyboardButton
{ {