| Total Complexity | 6 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class PushMessageContentPoll extends PushMessageContent |
||
| 15 | { |
||
| 16 | public const TYPE_NAME = 'pushMessageContentPoll'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Poll question. |
||
| 20 | * |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected string $question; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * True, if the poll is regular and not in quiz mode. |
||
| 27 | * |
||
| 28 | * @var bool |
||
| 29 | */ |
||
| 30 | protected bool $isRegular; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * True, if the message is a pinned message with the specified content. |
||
| 34 | * |
||
| 35 | * @var bool |
||
| 36 | */ |
||
| 37 | protected bool $isPinned; |
||
| 38 | |||
| 39 | public function __construct(string $question, bool $isRegular, bool $isPinned) |
||
| 40 | { |
||
| 41 | parent::__construct(); |
||
| 42 | |||
| 43 | $this->question = $question; |
||
| 44 | $this->isRegular = $isRegular; |
||
| 45 | $this->isPinned = $isPinned; |
||
| 46 | } |
||
| 47 | |||
| 48 | public static function fromArray(array $array): PushMessageContentPoll |
||
| 49 | { |
||
| 50 | return new static( |
||
| 51 | $array['question'], |
||
| 52 | $array['is_regular'], |
||
| 53 | $array['is_pinned'], |
||
| 54 | ); |
||
| 55 | } |
||
| 56 | |||
| 57 | public function typeSerialize(): array |
||
| 58 | { |
||
| 59 | return [ |
||
| 60 | '@type' => static::TYPE_NAME, |
||
| 61 | 'question' => $this->question, |
||
| 62 | 'is_regular' => $this->isRegular, |
||
| 63 | 'is_pinned' => $this->isPinned, |
||
| 64 | ]; |
||
| 65 | } |
||
| 66 | |||
| 67 | public function getQuestion(): string |
||
| 68 | { |
||
| 69 | return $this->question; |
||
| 70 | } |
||
| 71 | |||
| 72 | public function getIsRegular(): bool |
||
| 75 | } |
||
| 76 | |||
| 77 | public function getIsPinned(): bool |
||
| 80 | } |
||
| 81 | } |
||
| 82 |