2023-02-12 18:41:37 -05:00
|
|
|
<?php
|
|
|
|
|
2023-02-14 17:35:16 -05:00
|
|
|
|
2024-10-02 00:18:12 -04:00
|
|
|
namespace TgBotLib\Objects;
|
2023-02-12 18:41:37 -05:00
|
|
|
|
|
|
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
|
|
|
|
|
|
|
class ForumTopicCreated implements ObjectTypeInterface
|
|
|
|
{
|
2024-10-04 21:14:23 -04:00
|
|
|
private string $name;
|
|
|
|
private int $icon_color;
|
|
|
|
private ?string $icon_custom_emoji_id;
|
2023-02-12 18:41:37 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Name of the topic
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName(): string
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Color of the topic icon in RGB format
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getIconColor(): int
|
|
|
|
{
|
|
|
|
return $this->icon_color;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Optional. Unique identifier of the custom emoji shown as the topic icon
|
|
|
|
*
|
|
|
|
* @return string|null
|
|
|
|
*/
|
|
|
|
public function getIconCustomEmojiId(): ?string
|
|
|
|
{
|
|
|
|
return $this->icon_custom_emoji_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-10-04 21:14:23 -04:00
|
|
|
* @inheritDoch
|
2023-02-12 18:41:37 -05:00
|
|
|
*/
|
|
|
|
public function toArray(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'name' => $this->name,
|
|
|
|
'icon_color' => $this->icon_color,
|
|
|
|
'icon_custom_emoji_id' => $this->icon_custom_emoji_id,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-10-04 21:14:23 -04:00
|
|
|
* @inheritDoc
|
2023-02-12 18:41:37 -05:00
|
|
|
*/
|
2024-10-04 21:14:41 -04:00
|
|
|
public static function fromArray(?array $data): ?ForumTopicCreated
|
2023-02-12 18:41:37 -05:00
|
|
|
{
|
2024-10-04 21:14:41 -04:00
|
|
|
if($data === null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2023-02-14 17:35:16 -05:00
|
|
|
|
2024-10-04 21:14:41 -04:00
|
|
|
$object = new self();
|
2023-02-14 17:35:16 -05:00
|
|
|
$object->name = $data['name'] ?? null;
|
|
|
|
$object->icon_color = $data['icon_color'] ?? null;
|
|
|
|
$object->icon_custom_emoji_id = $data['icon_custom_emoji_id'] ?? null;
|
2023-02-12 18:41:37 -05:00
|
|
|
|
|
|
|
return $object;
|
|
|
|
}
|
|
|
|
}
|