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

ReplyKeyboardHide::setHideKeyboard()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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