SetInlineGameScore::getForce()   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 a game; for bots only.
13
 */
14
class SetInlineGameScore extends TdFunction
15
{
16
    public const TYPE_NAME = 'setInlineGameScore';
17
18
    /**
19
     * Inline message identifier.
20
     */
21
    protected string $inlineMessageId;
22
23
    /**
24
     * True, if the message should be edited.
25
     */
26
    protected bool $editMessage;
27
28
    /**
29
     * User identifier.
30
     */
31
    protected int $userId;
32
33
    /**
34
     * The new score.
35
     */
36
    protected int $score;
37
38
    /**
39
     * 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.
40
     */
41
    protected bool $force;
42
43
    public function __construct(string $inlineMessageId, bool $editMessage, int $userId, int $score, bool $force)
44
    {
45
        $this->inlineMessageId = $inlineMessageId;
46
        $this->editMessage     = $editMessage;
47
        $this->userId          = $userId;
48
        $this->score           = $score;
49
        $this->force           = $force;
50
    }
51
52
    public static function fromArray(array $array): SetInlineGameScore
53
    {
54
        return new static(
55
            $array['inline_message_id'],
56
            $array['edit_message'],
57
            $array['user_id'],
58
            $array['score'],
59
            $array['force'],
60
        );
61
    }
62
63
    public function typeSerialize(): array
64
    {
65
        return [
66
            '@type'             => static::TYPE_NAME,
67
            'inline_message_id' => $this->inlineMessageId,
68
            'edit_message'      => $this->editMessage,
69
            'user_id'           => $this->userId,
70
            'score'             => $this->score,
71
            'force'             => $this->force,
72
        ];
73
    }
74
75
    public function getInlineMessageId(): string
76
    {
77
        return $this->inlineMessageId;
78
    }
79
80
    public function getEditMessage(): bool
81
    {
82
        return $this->editMessage;
83
    }
84
85
    public function getUserId(): int
86
    {
87
        return $this->userId;
88
    }
89
90
    public function getScore(): int
91
    {
92
        return $this->score;
93
    }
94
95
    public function getForce(): bool
96
    {
97
        return $this->force;
98
    }
99
}
100