1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Keyboard.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Message\Param;
4
5
use Bitrix\Im;
6
use Bitrix\Im\V2\Message\Param;
7
use Bitrix\Im\V2\Result;
8
use Bitrix\Main\ArgumentException;
9
10
class
Keyboard
extends
Param
11
{
12
protected
?
Im\Bot\Keyboard
$keyboard
;
13
protected
bool
$isValid
=
true
;
14
19
public
function
setValue
(
$value
): self
20
{
21
if
(
$value
===
null
||
$value
=== $this->
getDefaultValue
())
22
{
23
return
$this->
unsetValue
();
24
}
25
26
if
(
$value
instanceof
Im
\
Bot
\
Keyboard
)
27
{
28
$this->keyboard =
$value
;
29
}
30
elseif
(!empty(
$value
))
31
{
32
$this->keyboard =
Im\Bot\Keyboard::getKeyboardByJson
(
$value
);
33
}
34
35
if
(isset($this->keyboard))
36
{
37
$this->value = $this->keyboard->getArray();
38
$this->jsonValue = $this->keyboard->getJson();
39
}
40
41
return
$this;
42
}
43
47
public
function
getValue
()
48
{
49
return
$this->value ?? $this->
getDefaultValue
();
50
}
51
52
public
function
getDefaultValue
()
53
{
54
return
'N'
;
55
}
56
61
public
function
saveValueFilter
(
$value
)
62
{
63
return
''
;
64
}
65
70
public
function
saveJsonFilter
(
$value
)
71
{
72
return
$this->jsonValue
;
73
}
74
79
public
function
loadJsonFilter
(
$value
)
80
{
81
if
(!empty(
$value
))
82
{
83
try
84
{
85
$this->value =
\Bitrix\Main\Web\Json::decode
(
$value
);
86
}
87
catch
(
ArgumentException
$ext)
88
{}
89
}
90
else
91
{
92
$value
=
null
;
93
}
94
95
return
$value
;
96
}
97
101
public
function
toRestFormat
()
102
{
103
return
$this->
getValue
();
104
}
105
109
public
function
toPullFormat
()
110
{
111
return
$this->
getValue
();
112
}
113
117
public
function
isValid
():
Result
118
{
119
$result
=
new
Result
();
120
121
if
($this->
isValid
&& (!isset($this->keyboard) || $this->keyboard->IsAllowSize()))
122
{
123
return
$result
;
124
}
125
126
return
$result
->addError(
new
ParamError
(
ParamError::KEYBOARD_ERROR
));
127
}
128
}
Bitrix\Im\Bot\Keyboard
Определения
keyboard.php:14
Bitrix\Im\Bot\Keyboard\getKeyboardByJson
static getKeyboardByJson($params, $textReplace=array(), $options=Array())
Определения
keyboard.php:196
Bitrix\Im\V2\Message\Param\Keyboard
Определения
Keyboard.php:11
Bitrix\Im\V2\Message\Param\Keyboard\$keyboard
Im Bot Keyboard $keyboard
Определения
Keyboard.php:12
Bitrix\Im\V2\Message\Param\Keyboard\$isValid
bool $isValid
Определения
Keyboard.php:13
Bitrix\Im\V2\Message\Param\Keyboard\toPullFormat
toPullFormat()
Определения
Keyboard.php:109
Bitrix\Im\V2\Message\Param\Keyboard\setValue
setValue($value)
Определения
Keyboard.php:19
Bitrix\Im\V2\Message\Param\Keyboard\isValid
isValid()
Определения
Keyboard.php:117
Bitrix\Im\V2\Message\Param\Keyboard\saveJsonFilter
saveJsonFilter($value)
Определения
Keyboard.php:70
Bitrix\Im\V2\Message\Param\Keyboard\loadJsonFilter
loadJsonFilter($value)
Определения
Keyboard.php:79
Bitrix\Im\V2\Message\Param\Keyboard\getValue
getValue()
Определения
Keyboard.php:47
Bitrix\Im\V2\Message\Param\Keyboard\saveValueFilter
saveValueFilter($value)
Определения
Keyboard.php:61
Bitrix\Im\V2\Message\Param\Keyboard\toRestFormat
toRestFormat()
Определения
Keyboard.php:101
Bitrix\Im\V2\Message\Param\Keyboard\getDefaultValue
getDefaultValue()
Определения
Keyboard.php:52
Bitrix\Im\V2\Message\Param\ParamError
Определения
ParamError.php:9
Bitrix\Im\V2\Message\Param\ParamError\KEYBOARD_ERROR
const KEYBOARD_ERROR
Определения
ParamError.php:12
Bitrix\Im\V2\Message\Param\$value
$value
Определения
Param.php:46
Bitrix\Im\V2\Message\Param\unsetValue
unsetValue()
Определения
Param.php:223
Bitrix\Im\V2\Message\Param\$jsonValue
string $jsonValue
Определения
Param.php:49
Bitrix\Main\ArgumentException
Определения
ArgumentException.php:9
Bitrix\Main\DB\Result
Определения
result.php:20
Bitrix\Main\Web\Json\decode
static decode($data)
Определения
json.php:50
$result
$result
Определения
get_property_values.php:14
Bitrix\Im\Bot
Определения
contextmenu.php:9
Bitrix\Im\V2\Chat\Param
Bitrix\Im
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
im
lib
V2
Message
Param
Keyboard.php
Создано системой
1.14.0