tgbotlib/src/TgBotLib/Objects/Dice.php
2024-10-04 14:07:46 -04:00

64 lines
No EOL
1.2 KiB
PHP

<?php
namespace TgBotLib\Objects;
use TgBotLib\Interfaces\ObjectTypeInterface;
class Dice implements ObjectTypeInterface
{
/**
* @var string
*/
private $emoji;
/**
* @var int
*/
private $value;
/**
* @return string
*/
public function getEmoji(): string
{
return $this->emoji;
}
/**
* @return int
*/
public function getValue(): int
{
return $this->value;
}
/**
* Constructs object from array representation
*
* @return array
*/
public function toArray(): array
{
return [
'emoji' => $this->emoji,
'value' => $this->value,
];
}
/**
* Constructs object from array representation
*
* @param array $data
* @return Dice
*/
public static function fromArray(array $data): self
{
$object = new self();
$object->emoji = $data['emoji'] ?? null;
$object->value = $data['value'] ?? null;
return $object;
}
}