ForceReply::setSelective()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
7
/**
8
 * Class ForceReply
9
 * Upon receiving a message with this object, Telegram clients will display a reply interface to the user
10
 * (act as if the user has selected the bot‘s message and tapped ’Reply').This can be extremely useful
11
 * if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15
class ForceReply extends BaseType
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    protected static $requiredParams = ['force_reply'];
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @var array
28
     */
29
    protected static $map = [
30
        'force_reply' => true,
31
        'input_field_placeholder' => true,
32
        'selective' => true
33
    ];
34
35
    /**
36
     * Shows reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply'
37
     *
38
     * @var bool
39
     */
40
    protected $forceReply;
41
42
    /**
43
     * The placeholder to be shown in the input field when the reply is active; 1-64 characters
44
     *
45
     * @var string|null
46
     */
47
    protected $inputFieldPlaceholder;
48
49
    /**
50
     * Optional. Use this parameter if you want to show the keyboard to specific users only.
51 12
     * Targets:
52
     * 1) users that are @mentioned in the text of the Message object;
53 12
     * 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
54 12
     *
55 12
     * @var bool|null
56
     */
57
    protected $selective;
58
59
    /**
60 1
     * @param bool $forceReply
61
     * @param bool|null $selective
62 1
     * @param string|null $inputFieldPlaceholder
63
     */
64
    public function __construct($forceReply = true, $selective = null, $inputFieldPlaceholder = null)
65
    {
66
        $this->forceReply = $forceReply;
67
        $this->selective = $selective;
68 2
        $this->inputFieldPlaceholder = $inputFieldPlaceholder;
69
    }
70 2
71 2
    /**
72
     * @return bool
73
     */
74
    public function isForceReply()
75
    {
76 1
        return $this->forceReply;
77
    }
78 1
79
    /**
80
     * @param bool $forceReply
81
     * @return void
82
     */
83
    public function setForceReply($forceReply)
84 2
    {
85
        $this->forceReply = $forceReply;
86 2
    }
87 2
88
    /**
89
     * @return bool|null
90
     */
91
    public function isSelective()
92
    {
93
        return $this->selective;
94
    }
95
96
    /**
97
     * @param bool|null $selective
98
     * @return void
99
     */
100
    public function setSelective($selective)
101
    {
102
        $this->selective = $selective;
103
    }
104
105
    /**
106
     * @param string|null $inputFieldPlaceholder
107
     * @return void
108
     */
109
    public function setInputFieldPlaceholder($inputFieldPlaceholder)
110
    {
111
        $this->inputFieldPlaceholder = $inputFieldPlaceholder;
112
    }
113
114
    /**
115
     * @return string|null
116
     */
117
    public function getInputFieldPlaceholder()
118
    {
119
        return $this->inputFieldPlaceholder;
120
    }
121
}
122