tgbotlib/src/TgBotLib/Objects/ChatLocation.php

55 lines
1.3 KiB
PHP
Raw Normal View History

2023-02-13 20:07:44 -05:00
<?php
2024-10-02 00:18:12 -04:00
namespace TgBotLib\Objects;
2023-02-13 20:07:44 -05:00
use TgBotLib\Interfaces\ObjectTypeInterface;
class ChatLocation implements ObjectTypeInterface
{
2024-10-04 14:56:02 -04:00
private Location $location;
private string $address;
2023-02-13 20:07:44 -05:00
/**
* The location to which the supergroup is connected. Can't be a live location.
*
* @return Location
*/
public function getLocation(): Location
{
return $this->location;
}
/**
* Location address; 1-64 characters, as defined by the chat owner
*
* @return string
*/
public function getAddress(): string
{
return $this->address;
}
/**
2024-10-04 14:56:02 -04:00
* @inheritDoc
2023-02-13 20:07:44 -05:00
*/
public function toArray(): array
{
return [
- Remove nullsafe operator from location property - 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
2024-11-03 18:07:06 -05:00
'location' => $this->location->toArray(),
2023-02-13 20:07:44 -05:00
'address' => $this->address,
];
}
/**
2024-10-04 14:56:02 -04:00
* @inheritDoc
2023-02-13 20:07:44 -05:00
*/
2024-10-04 14:56:02 -04:00
public static function fromArray(?array $data): ChatLocation
2023-02-13 20:07:44 -05:00
{
$object = new self();
$object->location = isset($data['location']) ? Location::fromArray($data['location']) : null;
2023-02-14 17:35:16 -05:00
$object->address = $data['address'] ?? null;
2023-02-13 20:07:44 -05:00
return $object;
}
}