KeyboardButton::setText()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zanzara\Telegram\Type\Keyboard;
6
7
/**
8
 * This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this
9
 * object to specify text of the button. Optional fields request_contact, request_location, and request_poll are
10
 * mutually exclusive.
11
 *
12
 * More on https://core.telegram.org/bots/api#keyboardbutton
13
 */
14
class KeyboardButton
15
{
16
17
    /**
18
     * Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
19
     *
20
     * @var string
21
     */
22
    private $text;
23
24
    /**
25
     * Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private
26
     * chats only
27
     *
28
     * @var bool|null
29
     */
30
    private $request_contact;
31
32
    /**
33
     * Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only
34
     *
35
     * @var bool|null
36
     */
37
    private $request_location;
38
39
    /**
40
     * Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed.
41
     * Available in private chats only
42
     *
43
     * @var KeyboardButtonPollType|null
44
     */
45
    private $request_poll;
46
47
    /**
48
     * @return string
49
     */
50
    public function getText(): string
51
    {
52
        return $this->text;
53
    }
54
55
    /**
56
     * @param string $text
57
     */
58
    public function setText(string $text): void
59
    {
60
        $this->text = $text;
61
    }
62
63
    /**
64
     * @return bool|null
65
     */
66
    public function getRequestContact(): ?bool
67
    {
68
        return $this->request_contact;
69
    }
70
71
    /**
72
     * @param bool|null $request_contact
73
     */
74
    public function setRequestContact(?bool $request_contact): void
75
    {
76
        $this->request_contact = $request_contact;
77
    }
78
79
    /**
80
     * @return bool|null
81
     */
82
    public function getRequestLocation(): ?bool
83
    {
84
        return $this->request_location;
85
    }
86
87
    /**
88
     * @param bool|null $request_location
89
     */
90
    public function setRequestLocation(?bool $request_location): void
91
    {
92
        $this->request_location = $request_location;
93
    }
94
95
    /**
96
     * @return KeyboardButtonPollType|null
97
     */
98
    public function getRequestPoll(): ?KeyboardButtonPollType
99
    {
100
        return $this->request_poll;
101
    }
102
103
    /**
104
     * @param KeyboardButtonPollType|null $request_poll
105
     */
106
    public function setRequestPoll(?KeyboardButtonPollType $request_poll): void
107
    {
108
        $this->request_poll = $request_poll;
109
    }
110
111
}