
- Fix user serialization in TransactionPartnerUser - Remove null check for stickers in StickerSet - Fix nullable operator usage in ShippingQuery toArray method - Remove null-safe operator for traveler and watcher - Fix null-safe operator in PreCheckoutQuery.php - Fix null safe operator usage in PollAnswer.php - Refactor null checks in PassportData methods - Remove nullsafe operator from chat property - Refactor web_app handling in MenuButtonWebApp class - Fix conditional assignment in InputMediaVideo - Fix null coalescing and array mapping in InputMediaAudio - Fix redundant null coalescing in caption_entities mapping - Fix parsing of caption_entities field in InlineQueryResultPhoto - Fix potential unnecessary null coalescing in caption_entities - Fix redundant null coalescence check in reply_markup assignment - Fix redundant null coalescing in array_map calls - Refactor: remove unnecessary null coalescing operator - Fix conditional check for caption_entities assignment - Fix handling of input_message_content array conversion - Fix potential null pointer issue in InlineQuery class - Remove redundant null check in toArray method - Fix redundant null coalesce operator in photo mapping - Remove null safe operator for origin - Fix redundant null coalescing in array_map calls. - Fix optional chaining error in ChosenInlineResult.php - Remove null-safe operator in toArray() method - Fix null safe operator usage in ChatMemberRestricted - Fix null-safe operator usage in ChatMemberOwner.php - Fix null safe operator usage in ChatMemberMember.php - Fix nullable operator usage in ChatMemberLeft class - Fix null-safe operator in ChatMemberBanned serialization. - Fix user attribute null coalescing in ChatMemberAdministrator - Fix null-safe operator usage in ChatLocation conversion - Remove null safe operator in toArray() method - Fix nullable operator usage in ChatInviteLink serialization - Fix potential null pointer issue in ChatBoostSourcePremium. - Remove null safe operator in ChatBoostRemoved toArray method - Fix 'from' property serialization in CallbackQuery - Fix nullable operator usage on chat property - Remove redundant type check for associative array - Remove deprecated BotOld.php file
62 lines
No EOL
1.6 KiB
PHP
62 lines
No EOL
1.6 KiB
PHP
<?php
|
|
|
|
|
|
namespace TgBotLib\Objects\MenuButton;
|
|
|
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
|
use TgBotLib\Objects\MenuButton;
|
|
use TgBotLib\Objects\WebAppInfo;
|
|
|
|
class MenuButtonWebApp extends MenuButton implements ObjectTypeInterface
|
|
{
|
|
private string $text;
|
|
private WebAppInfo $web_app;
|
|
|
|
/**
|
|
* Text on the button
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getText(): string
|
|
{
|
|
return $this->text;
|
|
}
|
|
|
|
/**
|
|
* Description of the Web App that will be launched when the user presses the button. The Web App will be able
|
|
* to send an arbitrary message on behalf of the user using the method answerWebAppQuery.
|
|
*
|
|
* @see https://core.telegram.org/bots/api#answerwebappquery
|
|
* @return WebAppInfo
|
|
*/
|
|
public function getWebApp(): WebAppInfo
|
|
{
|
|
return $this->web_app;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'type' => $this->type->value,
|
|
'text' => $this->text,
|
|
'web_app' => $this->web_app->toArray()
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public static function fromArray(?array $data): MenuButtonWebApp
|
|
{
|
|
$object = new self();
|
|
$object->type = $data['type'] ?? null;
|
|
$object->text = $data['text'] ?? null;
|
|
$object->web_app = isset($data['web_app']) ? WebAppInfo::fromArray($data['web_app']) : null;
|
|
|
|
return $object;
|
|
}
|
|
|
|
} |