Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F630093
InlineKeyboardButton.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
InlineKeyboardButton.php
View Options
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman
\
TelegramBot
\
Entities
;
use
Longman
\
TelegramBot
\
Exception
\
TelegramException
;
class
InlineKeyboardButton
extends
Entity
{
protected
$text
;
protected
$url
;
protected
$callback_data
;
protected
$switch_inline_query
;
/**
* InlineKeyboardButton constructor.
*
* @todo check if only one of 'url, callback_data, switch_inline_query' fields is set, documentation states that only one of these can be used
*
* @param array $data
*/
public
function
__construct
(
$data
=
array
(
)
)
{
$this
->
text
=
isset
(
$data
[
'text'
]
)
?
$data
[
'text'
]
:
null
;
if
(
empty
(
$this
->
text
)
)
{
throw
new
TelegramException
(
'text is empty!'
)
;
}
$this
->
url
=
isset
(
$data
[
'url'
]
)
?
$data
[
'url'
]
:
null
;
$this
->
callback_data
=
isset
(
$data
[
'callback_data'
]
)
?
$data
[
'callback_data'
]
:
null
;
$this
->
switch_inline_query
=
isset
(
$data
[
'switch_inline_query'
]
)
?
$data
[
'switch_inline_query'
]
:
null
;
if
(
$this
->
url
===
''
&&
$this
->
callback_data
===
''
&&
$this
->
switch_inline_query
===
''
)
{
throw
new
TelegramException
(
'You must use at least one of these fields: url, callback_data, switch_inline_query!'
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 15, 8:37 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
129546
Default Alt Text
InlineKeyboardButton.php (1 KB)
Attached To
Mode
R123 php-telegram-bot
Attached
Detach File
Event Timeline