PHP Class Longman\TelegramBot\Entities\Keyboard

Inheritance: extends Entity
Datei anzeigen Open project: akalongman/php-telegram-bot Class Usage Examples

Public Methods

Method Description
__construct ( $data = [] )
addRow ( ) Create a new row in keyboard and add buttons.
forceReply ( array $data = [] ) : Keyboard Display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply').
getKeyboardButtonClass ( ) : KeyboardButton | InlineKeyboardButton Get the proper keyboard button class for this keyboard.
getKeyboardType ( ) : string Get the type of keyboard, either "inline_keyboard" or "keyboard".
isInlineKeyboard ( ) : boolean If this keyboard is an inline keyboard.
remove ( array $data = [] ) : Keyboard Remove the current custom keyboard and display the default letter-keyboard.

Protected Methods

Method Description
createFromParams ( ) : array If no explicit keyboard is passed, try to create one from the parameters.
parseButton ( array | string | KeyboardButton $button ) : KeyboardButton | null Parse a given button to the correct KeyboardButton object type.
parseRow ( array $row ) : array Parse a given row to the correct array format.
validate ( )

Method Details

__construct() public method

public __construct ( $data = [] )

addRow() public method

Create a new row in keyboard and add buttons.
public addRow ( )

createFromParams() protected method

If no explicit keyboard is passed, try to create one from the parameters.
protected createFromParams ( ) : array
return array

forceReply() public static method

Display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply').
public static forceReply ( array $data = [] ) : Keyboard
$data array
return Keyboard

getKeyboardButtonClass() public method

Get the proper keyboard button class for this keyboard.
public getKeyboardButtonClass ( ) : KeyboardButton | InlineKeyboardButton
return KeyboardButton | InlineKeyboardButton

getKeyboardType() public method

Get the type of keyboard, either "inline_keyboard" or "keyboard".
public getKeyboardType ( ) : string
return string

isInlineKeyboard() public method

If this keyboard is an inline keyboard.
public isInlineKeyboard ( ) : boolean
return boolean

parseButton() protected method

Parse a given button to the correct KeyboardButton object type.
protected parseButton ( array | string | KeyboardButton $button ) : KeyboardButton | null
$button array | string | KeyboardButton
return KeyboardButton | null

parseRow() protected method

Parse a given row to the correct array format.
protected parseRow ( array $row ) : array
$row array
return array

remove() public static method

Remove the current custom keyboard and display the default letter-keyboard.
public static remove ( array $data = [] ) : Keyboard
$data array
return Keyboard

validate() protected method

protected validate ( )