inline_keyboard; } /** * Adds a row of buttons * * @param InlineKeyboardButton ...$buttons * @return $this */ public function addRow(InlineKeyboardButton ...$buttons): self { $this->inline_keyboard[] = $buttons; return $this; } /** * Removes a row of buttons by index * * @param int $index * @return $this */ public function removeRow(int $index): self { unset($this->inline_keyboard[$index]); return $this; } /** * Returns an array representation of the object * * @return array[][] */ public function toArray(): array { $data = []; if ($this->inline_keyboard !== null) { /** @var InlineKeyboardButton $item */ foreach ($this->inline_keyboard as $item) { $data[][] = $item->toArray(); } } return $data; } /** * Constructs the object from an array representation * * @param array $data * @return InlineKeyboardMarkup */ public static function fromArray(array $data): self { $object = new self(); $object->inline_keyboard = []; foreach($data as $item) { $object->inline_keyboard[] = InlineKeyboardButton::fromArray($item); } return $object; } }