Completed
Push — master ( a4a0d7...5dd6ba )
by Camilo
07:16
created

AnswerCallbackQuery::getMandatoryFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Methods;
6
7
use Psr\Log\LoggerInterface;
8
use unreal4u\TelegramAPI\Abstracts\TelegramMethods;
9
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
10
use unreal4u\TelegramAPI\InternalFunctionality\TelegramRawData;
11
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
12
13
/**
14
 * Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the
15
 * user as a notification at the top of the chat screen or as an alert. On success, True is returned.
16
 *
17
 * Objects defined as-is july 2016
18
 *
19
 * @see https://core.telegram.org/bots/api#answercallbackquery
20
 */
21
class AnswerCallbackQuery extends TelegramMethods
22
{
23
    /**
24
     * Unique identifier for the query to be answered
25
     * @var string
26
     */
27
    public $callback_query_id = '';
28
29
    /**
30
     * Optional. Text of the notification. If not specified, nothing will be shown to the user
31
     * @var string
32
     */
33
    public $text = '';
34
35
    /**
36
     * Optional. If true, an alert will be shown by the client instead of a notification at the top of the chat screen.
37
     * Defaults to false.
38
     * @var boolean
39
     */
40
    public $show_alert = false;
41
42
    public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes
43
    {
44
        return new ResultBoolean($data->getResultBoolean(), $logger);
45
    }
46
47
    public function getMandatoryFields(): array
48
    {
49
        return [
50
            'callback_query_id',
51
        ];
52
    }
53
}
54