69 lines
1.5 KiB
PHP
69 lines
1.5 KiB
PHP
![]() |
<?php
|
||
|
|
||
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||
|
|
||
|
namespace TgBotLib\Objects\BotCommandScope;
|
||
|
|
||
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||
|
|
||
|
class BotCommandScopeChat implements ObjectTypeInterface
|
||
|
{
|
||
|
/**
|
||
|
* @var string
|
||
|
*/
|
||
|
private $type;
|
||
|
|
||
|
/**
|
||
|
* @var int|string
|
||
|
*/
|
||
|
private $chat_id;
|
||
|
|
||
|
/**
|
||
|
* Scope type, must be chat
|
||
|
*
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getType(): string
|
||
|
{
|
||
|
return $this->type;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
|
||
|
*
|
||
|
* @return int|string
|
||
|
*/
|
||
|
public function getChatId(): int|string
|
||
|
{
|
||
|
return $this->chat_id;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Returns an array representation of the object
|
||
|
*
|
||
|
* @return array
|
||
|
*/
|
||
|
public function toArray(): array
|
||
|
{
|
||
|
return [
|
||
|
'type' => $this->type,
|
||
|
'chat_id' => $this->chat_id
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Constructs object from an array representation
|
||
|
*
|
||
|
* @param array $data
|
||
|
* @return ObjectTypeInterface
|
||
|
*/
|
||
|
public static function fromArray(array $data): ObjectTypeInterface
|
||
|
{
|
||
|
$object = new self();
|
||
|
|
||
|
$object->type = $data['type'];
|
||
|
$object->chat_id = $data['chat_id'];
|
||
|
|
||
|
return $object;
|
||
|
}
|
||
|
}
|