GetInlineQueryResults::getOffset()   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
 * Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires.
13
 */
14
class GetInlineQueryResults extends TdFunction
15
{
16
    public const TYPE_NAME = 'getInlineQueryResults';
17
18
    /**
19
     * The identifier of the target bot.
20
     */
21
    protected int $botUserId;
22
23
    /**
24
     * Identifier of the chat where the query was sent.
25
     */
26
    protected int $chatId;
27
28
    /**
29
     * Location of the user, only if needed.
30
     */
31
    protected Location $userLocation;
32
33
    /**
34
     * Text of the query.
35
     */
36
    protected string $query;
37
38
    /**
39
     * Offset of the first entry to return.
40
     */
41
    protected string $offset;
42
43
    public function __construct(int $botUserId, int $chatId, Location $userLocation, string $query, string $offset)
44
    {
45
        $this->botUserId    = $botUserId;
46
        $this->chatId       = $chatId;
47
        $this->userLocation = $userLocation;
48
        $this->query        = $query;
49
        $this->offset       = $offset;
50
    }
51
52
    public static function fromArray(array $array): GetInlineQueryResults
53
    {
54
        return new static(
55
            $array['bot_user_id'],
56
            $array['chat_id'],
57
            TdSchemaRegistry::fromArray($array['user_location']),
58
            $array['query'],
59
            $array['offset'],
60
        );
61
    }
62
63
    public function typeSerialize(): array
64
    {
65
        return [
66
            '@type'         => static::TYPE_NAME,
67
            'bot_user_id'   => $this->botUserId,
68
            'chat_id'       => $this->chatId,
69
            'user_location' => $this->userLocation->typeSerialize(),
70
            'query'         => $this->query,
71
            'offset'        => $this->offset,
72
        ];
73
    }
74
75
    public function getBotUserId(): int
76
    {
77
        return $this->botUserId;
78
    }
79
80
    public function getChatId(): int
81
    {
82
        return $this->chatId;
83
    }
84
85
    public function getUserLocation(): Location
86
    {
87
        return $this->userLocation;
88
    }
89
90
    public function getQuery(): string
91
    {
92
        return $this->query;
93
    }
94
95
    public function getOffset(): string
96
    {
97
        return $this->offset;
98
    }
99
}
100