AnswerCallbackQuery::getUrl()   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
 * Sets the result of a callback query; for bots only.
13
 */
14
class AnswerCallbackQuery extends TdFunction
15
{
16
    public const TYPE_NAME = 'answerCallbackQuery';
17
18
    /**
19
     * Identifier of the callback query.
20
     *
21
     * @var string
22
     */
23
    protected string $callbackQueryId;
24
25
    /**
26
     * Text of the answer.
27
     *
28
     * @var string
29
     */
30
    protected string $text;
31
32
    /**
33
     * If true, an alert should be shown to the user instead of a toast notification.
34
     *
35
     * @var bool
36
     */
37
    protected bool $showAlert;
38
39
    /**
40
     * URL to be opened.
41
     *
42
     * @var string
43
     */
44
    protected string $url;
45
46
    /**
47
     * Time during which the result of the query can be cached, in seconds.
48
     *
49
     * @var int
50
     */
51
    protected int $cacheTime;
52
53
    public function __construct(string $callbackQueryId, string $text, bool $showAlert, string $url, int $cacheTime)
54
    {
55
        $this->callbackQueryId = $callbackQueryId;
56
        $this->text            = $text;
57
        $this->showAlert       = $showAlert;
58
        $this->url             = $url;
59
        $this->cacheTime       = $cacheTime;
60
    }
61
62
    public static function fromArray(array $array): AnswerCallbackQuery
63
    {
64
        return new static(
65
            $array['callback_query_id'],
66
            $array['text'],
67
            $array['show_alert'],
68
            $array['url'],
69
            $array['cache_time'],
70
        );
71
    }
72
73
    public function typeSerialize(): array
74
    {
75
        return [
76
            '@type'             => static::TYPE_NAME,
77
            'callback_query_id' => $this->callbackQueryId,
78
            'text'              => $this->text,
79
            'show_alert'        => $this->showAlert,
80
            'url'               => $this->url,
81
            'cache_time'        => $this->cacheTime,
82
        ];
83
    }
84
85
    public function getCallbackQueryId(): string
86
    {
87
        return $this->callbackQueryId;
88
    }
89
90
    public function getText(): string
91
    {
92
        return $this->text;
93
    }
94
95
    public function getShowAlert(): bool
96
    {
97
        return $this->showAlert;
98
    }
99
100
    public function getUrl(): string
101
    {
102
        return $this->url;
103
    }
104
105
    public function getCacheTime(): int
106
    {
107
        return $this->cacheTime;
108
    }
109
}
110