Added BotName
This commit is contained in:
parent
4558ebb9a7
commit
02d9fe69d9
1 changed files with 46 additions and 0 deletions
46
src/TgBotLib/Objects/BotName.php
Normal file
46
src/TgBotLib/Objects/BotName.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Objects;
|
||||||
|
|
||||||
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||||
|
|
||||||
|
class BotName implements ObjectTypeInterface
|
||||||
|
{
|
||||||
|
private string $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bot's name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName(): string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function toArray(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->name
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function fromArray(?array $data): ?BotName
|
||||||
|
{
|
||||||
|
if($data === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = new self();
|
||||||
|
$object->name = $data['name'];
|
||||||
|
|
||||||
|
return $object;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue