Add ChatBoostUpdated object
This commit is contained in:
parent
6787654243
commit
27d1dce80f
1 changed files with 45 additions and 0 deletions
45
src/TgBotLib/Objects/ChatBoostUpdated.php
Normal file
45
src/TgBotLib/Objects/ChatBoostUpdated.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Objects;
|
||||
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class ChatBoostUpdated implements ObjectTypeInterface
|
||||
{
|
||||
private Chat $chat;
|
||||
private ChatBoost $boost;
|
||||
|
||||
public function getChat(): Chat
|
||||
{
|
||||
return $this->chat;
|
||||
}
|
||||
|
||||
public function getBoost(): ChatBoost
|
||||
{
|
||||
return $this->boost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): ?array
|
||||
{
|
||||
return [
|
||||
'chat' => $this->chat->toArray(),
|
||||
'boost' => $this->boost->toArray()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(?array $data): ?ChatBoostUpdated
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->chat = Chat::fromArray($data['chat']);
|
||||
$object->boost = ChatBoost::fromArray($data['boost']);
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue