Updated ReplyKeyboardMarkup

This commit is contained in:
netkas 2024-10-05 00:53:14 -04:00
parent af22e993b9
commit 1cd64da6af

View file

@ -10,32 +10,12 @@
/** /**
* @var KeyboardButton[][] * @var KeyboardButton[][]
*/ */
private $keyboard; private array $keyboard;
private bool $is_persistent;
/** private bool $resize_keyboard;
* @var bool private bool $one_time_keyboard;
*/ private ?string $input_field_placeholder;
private $is_persistent; private bool $selective;
/**
* @var bool
*/
private $resize_keyboard;
/**
* @var bool
*/
private $one_time_keyboard;
/**
* @var string|null
*/
private $input_field_placeholder;
/**
* @var bool
*/
private $selective;
/** /**
* Array of button rows, each represented by an Array of KeyboardButton objects * Array of button rows, each represented by an Array of KeyboardButton objects
@ -108,9 +88,7 @@
} }
/** /**
* Returns an array representation of the object. * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -125,16 +103,17 @@
} }
/** /**
* Constructs object from array representation. * @inheritDoc
*
* @param array $data
* @return ReplyKeyboardMarkup
*/ */
public static function fromArray(array $data): self public static function fromArray(?array $data): ?ReplyKeyboardMarkup
{ {
$object = new self(); $object = new self();
$object->keyboard = $data['keyboard'] ?? null; $object->keyboard = [];
foreach($data['keyboard'] as $keyboard)
{
$object->keyboard[] = KeyboardButton::fromArray($keyboard);
}
$object->is_persistent = $data['is_persistent'] ?? null; $object->is_persistent = $data['is_persistent'] ?? null;
$object->resize_keyboard = $data['resize_keyboard'] ?? null; $object->resize_keyboard = $data['resize_keyboard'] ?? null;
$object->one_time_keyboard = $data['one_time_keyboard'] ?? null; $object->one_time_keyboard = $data['one_time_keyboard'] ?? null;