|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Teebot\Entity; |
|
4
|
|
|
|
|
5
|
|
|
class ReplyKeyboardMarkup extends AbstractEntity |
|
6
|
|
|
{ |
|
7
|
|
|
|
|
8
|
|
|
const ENTITY_TYPE = 'ReplyKeyboardMarkup'; |
|
9
|
|
|
|
|
10
|
|
|
protected $keyboard; |
|
11
|
|
|
|
|
12
|
|
|
protected $resize_keyboard; |
|
13
|
|
|
|
|
14
|
|
|
protected $one_time_keyboard; |
|
15
|
|
|
|
|
16
|
|
|
protected $selective; |
|
17
|
|
|
|
|
18
|
|
|
protected $supportedProperties = [ |
|
19
|
|
|
'keyboard' => true, |
|
20
|
|
|
'resize_keyboard' => false, |
|
21
|
|
|
'one_time_keyboard' => false, |
|
22
|
|
|
'selective' => false, |
|
23
|
|
|
]; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @return array |
|
27
|
|
|
*/ |
|
28
|
|
|
public function getKeyboard() |
|
29
|
|
|
{ |
|
30
|
|
|
return $this->keyboard; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param array $keyboard |
|
35
|
|
|
* |
|
36
|
|
|
* @return $this |
|
37
|
|
|
*/ |
|
38
|
|
|
public function setKeyboard($keyboard) |
|
39
|
|
|
{ |
|
40
|
|
|
$this->keyboard = $keyboard; |
|
41
|
|
|
|
|
42
|
|
|
return $this; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @return mixed |
|
47
|
|
|
*/ |
|
48
|
|
|
public function getResizeKeyboard() |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->resize_keyboard; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @param mixed $resize_keyboard |
|
55
|
|
|
* |
|
56
|
|
|
* @return $this |
|
57
|
|
|
*/ |
|
58
|
|
|
public function setResizeKeyboard($resize_keyboard) |
|
59
|
|
|
{ |
|
60
|
|
|
$this->resize_keyboard = $resize_keyboard; |
|
61
|
|
|
|
|
62
|
|
|
return $this; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return mixed |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getOneTimeKeyboard() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->one_time_keyboard; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @param mixed $one_time_keyboard |
|
75
|
|
|
* |
|
76
|
|
|
* @return $this |
|
77
|
|
|
*/ |
|
78
|
|
|
public function setOneTimeKeyboard($one_time_keyboard) |
|
79
|
|
|
{ |
|
80
|
|
|
$this->one_time_keyboard = $one_time_keyboard; |
|
81
|
|
|
|
|
82
|
|
|
return $this; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @return mixed |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getSelective() |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->selective; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @param mixed $selective |
|
95
|
|
|
* |
|
96
|
|
|
* @return $this |
|
97
|
|
|
*/ |
|
98
|
|
|
public function setSelective($selective) |
|
99
|
|
|
{ |
|
100
|
|
|
$this->selective = $selective; |
|
101
|
|
|
|
|
102
|
|
|
return $this; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* Returns object's properties encoded as JSON string |
|
107
|
|
|
* |
|
108
|
|
|
* @param bool $validate Flag whether validation for required properties should be applied |
|
109
|
|
|
* |
|
110
|
|
|
* @return string |
|
111
|
|
|
*/ |
|
112
|
|
|
public function asJson($validate = true) |
|
113
|
|
|
{ |
|
114
|
|
|
$properties = $this->getPropertiesArray($validate); |
|
115
|
|
|
|
|
116
|
|
|
if (isset($properties['keyboard']) && !empty($properties['keyboard'])) { |
|
117
|
|
|
foreach ($properties['keyboard'] as $i => $row) { |
|
118
|
|
|
if (!is_array($row)) { |
|
119
|
|
|
continue; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** @var $button AbstractEntity */ |
|
123
|
|
|
foreach ($row as $j => $button) { |
|
124
|
|
|
$properties['keyboard'][$i][$j] = $button->getPropertiesArray($validate); |
|
125
|
|
|
} |
|
126
|
|
|
} |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
return json_encode($properties); |
|
130
|
|
|
} |
|
131
|
|
|
} |
|
132
|
|
|
|