Passed
Pull Request — master (#408)
by Alexander
01:37
created

ReplyKeyboardHide   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 13
c 0
b 0
f 0
dl 0
loc 72
ccs 13
cts 13
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isSelective() 0 3 1
A setSelective() 0 3 1
A isHideKeyboard() 0 3 1
A setHideKeyboard() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
7
/**
8
 * Class ReplyKeyboardHide
9
 * Upon receiving a message with this object, Telegram clients will hide the current custom keyboard
10
 * and display the default letter-keyboard. By default, custom keyboards are displayed
11
 * until a new keyboard is sent by a bot. An exception is made for one-time keyboards
12
 * that are hidden immediately after the user presses a button (see \TelegramBot\Api\Types\ReplyKeyboardMarkup).
13
 *
14
 * @package TelegramBot\Api\Types
15
 */
16
class ReplyKeyboardHide extends BaseType
17
{
18
    /**
19
     * {@inheritdoc}
20
     *
21
     * @var array
22
     */
23
    static protected $requiredParams = ['hide_keyboard'];
24
25
    /**
26
     * {@inheritdoc}
27
     *
28
     * @var array
29
     */
30
    static protected $map = [
31
        'hide_keyboard' => true,
32
        'selective' => true
33
    ];
34
35
    /**
36
     * Requests clients to hide the custom keyboard
37
     *
38
     * @var bool
39
     */
40
    protected $hideKeyboard;
41
42
    /**
43
     * Optional. Use this parameter if you want to show the keyboard to specific users only.
44
     * Targets:
45
     * 1) users that are @mentioned in the text of the Message object;
46
     * 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
47
     *
48
     * @var bool
49
     */
50
    protected $selective;
51
52 12
    public function __construct($hideKeyboard = true, $selective = null)
53
    {
54 12
        $this->hideKeyboard = $hideKeyboard;
55 12
        $this->selective = $selective;
56 12
    }
57
58
    /**
59
     * @return boolean
60
     */
61 1
    public function isHideKeyboard()
62
    {
63 1
        return $this->hideKeyboard;
64
    }
65
66
    /**
67
     * @param boolean $hideKeyboard
68
     */
69 2
    public function setHideKeyboard($hideKeyboard)
70
    {
71 2
        $this->hideKeyboard = $hideKeyboard;
72 2
    }
73
74
    /**
75
     * @return boolean
76
     */
77 1
    public function isSelective()
78
    {
79 1
        return $this->selective;
80
    }
81
82
    /**
83
     * @param boolean $selective
84
     */
85 2
    public function setSelective($selective)
86
    {
87 2
        $this->selective = $selective;
88 2
    }
89
}
90