UpdateNewChosenInlineResult::getInlineMessageId()   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 AurimasNiekis\TdLibSchema;
10
11
/**
12
 * The user has chosen a result of an inline query; for bots only.
13
 */
14
class UpdateNewChosenInlineResult extends Update
15
{
16
    public const TYPE_NAME = 'updateNewChosenInlineResult';
17
18
    /**
19
     * Identifier of the user who sent the query.
20
     *
21
     * @var int
22
     */
23
    protected int $senderUserId;
24
25
    /**
26
     * User location, provided by the client; may be null.
27
     *
28
     * @var Location|null
29
     */
30
    protected ?Location $userLocation;
31
32
    /**
33
     * Text of the query.
34
     *
35
     * @var string
36
     */
37
    protected string $query;
38
39
    /**
40
     * Identifier of the chosen result.
41
     *
42
     * @var string
43
     */
44
    protected string $resultId;
45
46
    /**
47
     * Identifier of the sent inline message, if known.
48
     *
49
     * @var string
50
     */
51
    protected string $inlineMessageId;
52
53
    public function __construct(int $senderUserId, ?Location $userLocation, string $query, string $resultId, string $inlineMessageId)
54
    {
55
        parent::__construct();
56
57
        $this->senderUserId    = $senderUserId;
58
        $this->userLocation    = $userLocation;
59
        $this->query           = $query;
60
        $this->resultId        = $resultId;
61
        $this->inlineMessageId = $inlineMessageId;
62
    }
63
64
    public static function fromArray(array $array): UpdateNewChosenInlineResult
65
    {
66
        return new static(
67
            $array['sender_user_id'],
68
            (isset($array['user_location']) ? TdSchemaRegistry::fromArray($array['user_location']) : null),
69
            $array['query'],
70
            $array['result_id'],
71
            $array['inline_message_id'],
72
        );
73
    }
74
75
    public function typeSerialize(): array
76
    {
77
        return [
78
            '@type'             => static::TYPE_NAME,
79
            'sender_user_id'    => $this->senderUserId,
80
            'user_location'     => (isset($this->userLocation) ? $this->userLocation : null),
81
            'query'             => $this->query,
82
            'result_id'         => $this->resultId,
83
            'inline_message_id' => $this->inlineMessageId,
84
        ];
85
    }
86
87
    public function getSenderUserId(): int
88
    {
89
        return $this->senderUserId;
90
    }
91
92
    public function getUserLocation(): ?Location
93
    {
94
        return $this->userLocation;
95
    }
96
97
    public function getQuery(): string
98
    {
99
        return $this->query;
100
    }
101
102
    public function getResultId(): string
103
    {
104
        return $this->resultId;
105
    }
106
107
    public function getInlineMessageId(): string
108
    {
109
        return $this->inlineMessageId;
110
    }
111
}
112