Added \TgBotLib\Objects > InlineKeyboardMarkup

This commit is contained in:
Netkas 2023-02-13 13:57:03 -05:00
parent 8478383309
commit 47743dd487

View file

@ -0,0 +1,52 @@
<?php
/** @noinspection PhpMissingFieldTypeInspection */
namespace TgBotLib\Objects;
use TgBotLib\Interfaces\ObjectTypeInterface;
class InlineKeyboardMarkup implements ObjectTypeInterface
{
/**
* @var InlineKeyboardButton[][]
*/
private $inline_keyboard;
/**
* Array of button rows, each represented by an Array of InlineKeyboardButton objects
*
* @see https://core.telegram.org/bots/api#inlinekeyboardmarkup
* @return InlineKeyboardButton[][]
*/
public function getInlineKeyboard(): array
{
return $this->inline_keyboard;
}
/**
* Returns an array representation of the object
*
* @return InlineKeyboardButton[][][]
*/
public function toArray(): array
{
return [
'inline_keyboard' => $this->inline_keyboard,
];
}
/**
* Constructs the object from an array representation
*
* @param array $data
* @return ObjectTypeInterface
*/
public static function fromArray(array $data): ObjectTypeInterface
{
$object = new self();
$object->inline_keyboard = @$data['inline_keyboard'] ?? null;
return $object;
}
}