Added \TgBotLib\Objects > InlineKeyboardMarkup
This commit is contained in:
parent
8478383309
commit
47743dd487
1 changed files with 52 additions and 0 deletions
52
src/TgBotLib/Objects/InlineKeyboardMarkup.php
Normal file
52
src/TgBotLib/Objects/InlineKeyboardMarkup.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue