tgbotlib/src/TgBotLib/Objects/BusinessIntro.php

73 lines
1.7 KiB
PHP
Raw Normal View History

2024-10-04 12:38:08 -04:00
<?php
namespace TgBotLib\Objects;
use TgBotLib\Interfaces\ObjectTypeInterface;
2024-10-04 15:11:50 -04:00
use TgBotLib\Objects\Stickers\Sticker;
2024-10-04 12:38:08 -04:00
class BusinessIntro implements ObjectTypeInterface
{
private ?string $title;
private ?string $message;
private ?Sticker $sticker;
/**
* Optional. Title text of the business intro
*
* @return string|null
*/
public function getTitle(): ?string
{
return $this->title;
}
/**
* Optional. Message text of the business intro
*
* @return string|null
*/
public function getMessage(): ?string
{
return $this->message;
}
/**
* Optional. Sticker of the business intro
*
* @return Sticker|null
*/
public function getSticker(): ?Sticker
{
return $this->sticker;
}
/**
* @inheritDoc
*/
public function toArray(): ?array
{
return [
'title' => $this->title,
'message' => $this->message,
'sticker' => $this->sticker?->toArray()
];
}
/**
* @inheritDoc
*/
public static function fromArray(?array $data): ?ObjectTypeInterface
{
if($data === null)
{
return null;
}
$object = new self();
$object->title = $data['title'] ?? null;
$object->message = $data['message'] ?? null;
$object->sticker = Sticker::fromArray($data['sticker']) ?? null;
return $object;
}
}