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