PushMessageContentGameScore::getScore()   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
 * A new high score was achieved in a game.
13
 */
14
class PushMessageContentGameScore extends PushMessageContent
15
{
16
    public const TYPE_NAME = 'pushMessageContentGameScore';
17
18
    /**
19
     * Game title, empty for pinned message.
20
     */
21
    protected string $title;
22
23
    /**
24
     * New score, 0 for pinned message.
25
     */
26
    protected int $score;
27
28
    /**
29
     * True, if the message is a pinned message with the specified content.
30
     */
31
    protected bool $isPinned;
32
33
    public function __construct(string $title, int $score, bool $isPinned)
34
    {
35
        parent::__construct();
36
37
        $this->title    = $title;
38
        $this->score    = $score;
39
        $this->isPinned = $isPinned;
40
    }
41
42
    public static function fromArray(array $array): PushMessageContentGameScore
43
    {
44
        return new static(
45
            $array['title'],
46
            $array['score'],
47
            $array['is_pinned'],
48
        );
49
    }
50
51
    public function typeSerialize(): array
52
    {
53
        return [
54
            '@type'     => static::TYPE_NAME,
55
            'title'     => $this->title,
56
            'score'     => $this->score,
57
            'is_pinned' => $this->isPinned,
58
        ];
59
    }
60
61
    public function getTitle(): string
62
    {
63
        return $this->title;
64
    }
65
66
    public function getScore(): int
67
    {
68
        return $this->score;
69
    }
70
71
    public function getIsPinned(): bool
72
    {
73
        return $this->isPinned;
74
    }
75
}
76