Moved Objects

This commit is contained in:
netkas 2024-10-02 00:18:12 -04:00
parent 848a2a78e3
commit 6c67e97a4b
167 changed files with 368 additions and 373 deletions

View file

@ -1,62 +0,0 @@
<?php
namespace TgBotLib\Objects\Telegram\MessageOrigin;
use TgBotLib\Enums\Types\MessageOriginType;
use TgBotLib\Interfaces\ObjectTypeInterface;
use TgBotLib\Objects\Telegram\Chat;
use TgBotLib\Objects\Telegram\MessageOrigin;
class MessageOriginChat extends MessageOrigin implements ObjectTypeInterface
{
private Chat $sender_chat;
private ?string $author_signature;
/**
* Unique message identifier inside the chat
*
* @return Chat
*/
public function getSenderChat(): Chat
{
return $this->sender_chat;
}
/**
* Optional. Signature of the original post author
*
* @return string|null
*/
public function getAuthorSignature(): ?string
{
return $this->author_signature;
}
/**
* @inheritDoc
*/
public function toArray(): array
{
return [
'type' => $this->getType()->value,
'date' => $this->getDate(),
'sender_chat' => $this->sender_chat->toArray(),
'author_signature' => $this->author_signature,
];
}
/**
* @inheritDoc
*/
public static function fromArray(array $data): MessageOrigin
{
$object = new self();
$object->type = MessageOriginType::CHAT;
$object->date = $data['date'];
$object->sender_chat = Chat::fromArray($data['sender_chat']);
$object->author_signature = $data['author_signature'] ?? null;
return $object;
}
}