Added \TgBotLib\Objects > KeyboardButtonPollType

This commit is contained in:
Netkas 2023-02-13 13:46:53 -05:00
parent 58b35ecb2a
commit dfbe46443f

View file

@ -0,0 +1,50 @@
<?php
namespace TgBotLib\Objects;
use TgBotLib\Interfaces\ObjectTypeInterface;
class KeyboardButtonPollType implements ObjectTypeInterface
{
/**
* @var string|null
*/
private $type;
/**
* Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode.
* If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed
* to create a poll of any type.
*
* @return string|null
*/
public function getType(): ?string
{
return $this->type;
}
/**
* Returns an array representation of the object
*
* @return null[]|string[]
*/
public function toArray(): array
{
return [
'type' => $this->type,
];
}
/**
* Constructs the object from an array representation
*
* @param array $data
* @return ObjectTypeInterface
*/
public static function fromArray(array $data): ObjectTypeInterface
{
$object = new self();
$object->type = @$data['type'] ?? null;
return $object;
}
}