class ButtonCollection extends BaseCollection (View source)

Class ButtonCollection

Properties

protected array $elements Elements from BaseCollection

Methods

array
getElements()

Get elements

add($element)

Add item to collection

array
toData()

Get all elements array data

bool
isEmpty()

Collection is empty

bool
validator($elements)

Valid the added element

__construct(array $buttons = [])

ButtonCollection constructor.

addPostBackButton($text, $payload = '')

Add postback button

addWebButton($text, $url)

Add web url button

$this
addAccountLinkButton($url)

Add account link button

$this
addCallButton($title, $phone)

Add phone call button

$this
addShareButton($shareContent = null)

Add share button

Details

array getElements()

Get elements

Return Value

array

add($element)

Add item to collection

Parameters

$element

array toData()

Get all elements array data

Return Value

array

bool isEmpty()

Collection is empty

Return Value

bool

bool validator($elements)

Valid the added element

Parameters

$elements

Return Value

bool

Exceptions

ValidatorStructureException

__construct(array $buttons = [])

ButtonCollection constructor.

Parameters

array $buttons

ButtonCollection addPostBackButton($text, $payload = '')

Add postback button

Parameters

$text
$payload

Return Value

ButtonCollection

ButtonCollection addWebButton($text, $url)

Add web url button

Parameters

$text
$url

Return Value

ButtonCollection

$this addAccountLinkButton($url)

Add account link button

Parameters

$url

Return Value

$this

$this addCallButton($title, $phone)

Add phone call button

Parameters

$title
$phone

Return Value

$this

Exceptions

OnlyUseByItselfException

$this addShareButton($shareContent = null)

Add share button

Parameters

$shareContent

Return Value

$this