SetGameScore::getChatId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace PHPTdGram\Schema;
10
11
/**
12
 * Updates the game score of the specified user in the game; for bots only.
13
 */
14
class SetGameScore extends TdFunction
15
{
16
    public const TYPE_NAME = 'setGameScore';
17
18
    /**
19
     * The chat to which the message with the game belongs.
20
     */
21
    protected int $chatId;
22
23
    /**
24
     * Identifier of the message.
25
     */
26
    protected int $messageId;
27
28
    /**
29
     * True, if the message should be edited.
30
     */
31
    protected bool $editMessage;
32
33
    /**
34
     * User identifier.
35
     */
36
    protected int $userId;
37
38
    /**
39
     * The new score.
40
     */
41
    protected int $score;
42
43
    /**
44
     * Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table.
45
     */
46
    protected bool $force;
47
48
    public function __construct(int $chatId, int $messageId, bool $editMessage, int $userId, int $score, bool $force)
49
    {
50
        $this->chatId      = $chatId;
51
        $this->messageId   = $messageId;
52
        $this->editMessage = $editMessage;
53
        $this->userId      = $userId;
54
        $this->score       = $score;
55
        $this->force       = $force;
56
    }
57
58
    public static function fromArray(array $array): SetGameScore
59
    {
60
        return new static(
61
            $array['chat_id'],
62
            $array['message_id'],
63
            $array['edit_message'],
64
            $array['user_id'],
65
            $array['score'],
66
            $array['force'],
67
        );
68
    }
69
70
    public function typeSerialize(): array
71
    {
72
        return [
73
            '@type'        => static::TYPE_NAME,
74
            'chat_id'      => $this->chatId,
75
            'message_id'   => $this->messageId,
76
            'edit_message' => $this->editMessage,
77
            'user_id'      => $this->userId,
78
            'score'        => $this->score,
79
            'force'        => $this->force,
80
        ];
81
    }
82
83
    public function getChatId(): int
84
    {
85
        return $this->chatId;
86
    }
87
88
    public function getMessageId(): int
89
    {
90
        return $this->messageId;
91
    }
92
93
    public function getEditMessage(): bool
94
    {
95
        return $this->editMessage;
96
    }
97
98
    public function getUserId(): int
99
    {
100
        return $this->userId;
101
    }
102
103
    public function getScore(): int
104
    {
105
        return $this->score;
106
    }
107
108
    public function getForce(): bool
109
    {
110
        return $this->force;
111
    }
112
}
113