tgbotlib/src/TgBotLib/Objects/ForumTopicEdited.php

61 lines
1.5 KiB
PHP
Raw Normal View History

<?php
2024-10-02 00:18:12 -04:00
namespace TgBotLib\Objects;
use TgBotLib\Interfaces\ObjectTypeInterface;
class ForumTopicEdited implements ObjectTypeInterface
{
2024-10-04 21:15:28 -04:00
private ?string $name;
private ?string $icon_custom_emoji_id;
/**
* Optional. New name of the topic, if it was edited
*
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* Optional. New identifier of the custom emoji shown as the topic icon, if it was edited;
* an empty string if the icon was removed
*
* @return string|null
*/
public function getIconCustomEmojiId(): ?string
{
return $this->icon_custom_emoji_id;
}
/**
2024-10-04 21:15:28 -04:00
* @inheritDoc
*/
public function toArray(): array
{
return [
'name' => $this->name ?? null,
'icon_custom_emoji_id' => $this->icon_custom_emoji_id ?? null,
];
}
/**
2024-10-04 21:15:28 -04:00
* @inheritDoc
*/
2024-10-04 21:15:28 -04:00
public static function fromArray(?array $data): ?ForumTopicEdited
{
2024-10-04 21:15:28 -04:00
if($data === null)
{
return null;
}
2024-10-04 21:15:28 -04:00
$object = new self();
2023-02-14 17:35:16 -05:00
$object->name = $data['name'] ?? null;
$object->icon_custom_emoji_id = $data['icon_custom_emoji_id'] ?? null;
return $object;
}
}