Added \TgBotLib\Objects > KeyboardButtonPollType
This commit is contained in:
parent
58b35ecb2a
commit
dfbe46443f
1 changed files with 50 additions and 0 deletions
50
src/TgBotLib/Objects/KeyboardButtonPollType.php
Normal file
50
src/TgBotLib/Objects/KeyboardButtonPollType.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue