ReplyKeyboardMarkupType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 54
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Type;
6
7
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
8
9
/**
10
 * Class ReplyKeyboardMarkupType.
11
 *
12
 * @see https://core.telegram.org/bots/api#replykeyboardmarkup
13
 * @see https://core.telegram.org/bots#keyboards
14
 */
15
class ReplyKeyboardMarkupType
16
{
17
    use FillFromArrayTrait;
18
19
    /**
20
     * Array of button rows, each represented by an Array of KeyboardButton objects.
21
     *
22
     * @var KeyboardButtonType[][]
23
     */
24
    public $keyboard;
25
26
    /**
27
     * Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller
28
     * if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always
29
     * of the same height as the app's standard keyboard.
30
     *
31
     * @var bool|null
32
     */
33
    public $resizeKeyboard;
34
35
    /**
36
     * Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available,
37
     * but clients will automatically display the usual letter-keyboard in the chat – the user can press a special
38
     * button in the input field to see the custom keyboard again. Defaults to false.
39
     *
40
     * @var bool|null
41
     */
42
    public $oneTimeKeyboard;
43
44
    /**
45
     * Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users
46
     * that are @mentioned in the text of the MessageType object;
47
     * 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
48
     *
49
     * Example: A user requests to change the bot‘s language, bot replies to the request with a keyboard to
50
     * select the new language. Other users in the group don’t see the keyboard.
51
     *
52
     * @var bool|null
53
     */
54
    public $selective;
55
56
    /**
57
     * ReplyKeyboardMarkupType constructor.
58
     *
59
     * @param array      $keyboard
60
     * @param array|null $data
61
     *
62
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
63
     */
64
    public function __construct(array $keyboard = [], array $data = null)
65
    {
66
        $this->keyboard = $keyboard;
67
        if ($data) {
68
            $this->fill($data);
69
        }
70
    }
71
}
72