Refactored Namespace
This commit is contained in:
parent
45edd758a1
commit
1ef4e52a46
99 changed files with 136 additions and 136 deletions
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
class BotCommandScopeAllChatAdministrators implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
private $chat_id;
|
||||
|
||||
/**
|
||||
* Scope type, must be all_chat_administrators
|
||||
*
|
||||
* @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'] ?? BotCommandScopeType::AllChatAdministrators;
|
||||
$object->chat_id = $data['chat_id'] ?? null;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from BotCommandScope
|
||||
*
|
||||
* @param BotCommandScope $botCommandScope
|
||||
* @return static
|
||||
*/
|
||||
public static function fromBotCommandScope(BotCommandScope $botCommandScope): self
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $botCommandScope->getType();
|
||||
$object->chat_id = $botCommandScope->getChatId();
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
class BotCommandScopeAllGroupChats implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* Scope type, must be all_group_chats
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->type
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'] ?? BotCommandScopeType::AllGroupChats;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from BotCommandScope
|
||||
*
|
||||
* @param BotCommandScope $botCommandScope
|
||||
* @return BotCommandScopeAllGroupChats
|
||||
*/
|
||||
public static function fromBotCommandScope(BotCommandScope $botCommandScope): BotCommandScopeAllGroupChats
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $botCommandScope->getType();
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
class BotCommandScopeAllPrivateChats implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* Scope type, must be all_private_chats
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->type
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'] ?? BotCommandScopeType::AllPrivateChats;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from BotCommandScope
|
||||
*
|
||||
* @param BotCommandScope $botCommandScope
|
||||
* @return BotCommandScopeAllPrivateChats
|
||||
*/
|
||||
public static function fromBotCommandScope(BotCommandScope $botCommandScope): BotCommandScopeAllPrivateChats
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $botCommandScope->getType();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
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'] ?? BotCommandScopeType::Chat;
|
||||
$object->chat_id = $data['chat_id'] ?? null;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from BotCommandScope
|
||||
*
|
||||
* @param BotCommandScope $botCommandScope
|
||||
* @return static
|
||||
*/
|
||||
public static function fromBotCommandScope(BotCommandScope $botCommandScope): self
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $botCommandScope->getType();
|
||||
$object->chat_id = $botCommandScope->getChatId();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
class BotCommandScopeChatAdministrators implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* Scope type, must be chat_administrators
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->type
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'] ?? BotCommandScopeType::ChatAdministrators;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from BotCommandScope
|
||||
*
|
||||
* @param BotCommandScope $botCommandScope
|
||||
* @return BotCommandScopeChatAdministrators
|
||||
*/
|
||||
public static function fromBotCommandScope(BotCommandScope $botCommandScope): BotCommandScopeChatAdministrators
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $botCommandScope->getType();
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
class BotCommandScopeChatMember implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var string|int
|
||||
*/
|
||||
private $chat_id;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $user_id;
|
||||
|
||||
/**
|
||||
* Scope type, must be chat_member
|
||||
*
|
||||
* @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 string|int
|
||||
*/
|
||||
public function getChatId(): string|int
|
||||
{
|
||||
return $this->chat_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier of the target user
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getUserId(): int
|
||||
{
|
||||
return $this->user_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->type,
|
||||
'chat_id' => $this->chat_id,
|
||||
'user_id' => $this->user_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'] ?? BotCommandScopeType::ChatMember;
|
||||
$object->chat_id = $data['chat_id'] ?? null;
|
||||
$object->user_id = $data['user_id'] ?? null;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from BotCommandScope
|
||||
*
|
||||
* @param BotCommandScope $botCommandScope
|
||||
* @return static
|
||||
*/
|
||||
public static function fromBotCommandScope(BotCommandScope $botCommandScope): self
|
||||
{
|
||||
$object = new self();
|
||||
$object->type = $botCommandScope->getType();
|
||||
$object->chat_id = $botCommandScope->getChatId();
|
||||
$object->user_id = $botCommandScope->getUserId();
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BotCommandScope;
|
||||
|
||||
class BotCommandScopeDefault implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* Scope type, must be default
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->type
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'] ?? BotCommandScopeType::Default;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from BotCommandScope
|
||||
*
|
||||
* @param BotCommandScope $botCommandScope
|
||||
* @return BotCommandScopeDefault
|
||||
*/
|
||||
public static function fromBotCommandScope(BotCommandScope $botCommandScope): BotCommandScopeDefault
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $botCommandScope->getType();
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue