PushMessageContentPoll   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getIsRegular() 0 3 1
A getQuestion() 0 3 1
A getIsPinned() 0 3 1
A fromArray() 0 6 1
A __construct() 0 7 1
A typeSerialize() 0 7 1
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace AurimasNiekis\TdLibSchema;
10
11
/**
12
 * A message with a poll.
13
 */
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
73
    {
74
        return $this->isRegular;
75
    }
76
77
    public function getIsPinned(): bool
78
    {
79
        return $this->isPinned;
80
    }
81
}
82