1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Attach.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Message\Param
;
4
5
use
Bitrix\Im\V2\Message\Param
;
6
use
Bitrix\Im\V2\Result
;
7
use
Bitrix\Main\ArgumentException
;
8
9
class
Attach
extends
Param
10
{
11
private
?\CIMMessageParamAttach $attach =
null
;
12
private
bool
$isValid =
true
;
13
14
protected
?
string
$type
=
Param::TYPE_JSON
;
15
20
public
function
setValue
(
$value
): self
21
{
22
if
(
$value
===
null
||
$value
=== $this->
getDefaultValue
())
23
{
24
return
$this->
unsetValue
();
25
}
26
if
(
$value
instanceof \CIMMessageParamAttach)
27
{
28
$this->attach =
$value
;
29
}
30
elseif
(!empty(
$value
))
31
{
32
$this->attach = \CIMMessageParamAttach::GetAttachByJson(
$value
);
33
}
34
35
if
(isset($this->attach))
36
{
37
$this->value = $this->attach->getArray();
38
$this->jsonValue = $this->attach->getJson();
39
}
40
41
return
$this;
42
}
43
47
public
function
getValue
()
48
{
49
return
$this->value;
50
}
51
56
public
function
saveValueFilter
(
$value
)
57
{
58
$value
=
''
;
59
if
(!empty($this->value[
'DESCRIPTION'
]))
60
{
61
$value
= parent::saveValueFilter($this->value[
'DESCRIPTION'
]);
62
}
63
64
return
$value
;
65
}
66
71
public
function
saveJsonFilter
(
$value
)
72
{
73
return
$this->jsonValue;
74
}
75
80
public
function
loadJsonFilter
(
$value
)
81
{
82
if
(!empty(
$value
))
83
{
84
try
85
{
86
$val
=
\Bitrix\Main\Web\Json::decode
(
$value
);
87
$this->value = \CIMMessageParamAttach::PrepareAttach(
$val
);
88
}
89
catch
(
ArgumentException
$ext)
90
{}
91
}
92
else
93
{
94
$value
=
null
;
95
}
96
97
return
$value
;
98
}
99
103
public
function
toRestFormat
(): ?
array
104
{
105
return
$this->
getValue
();
106
}
107
111
public
function
toPullFormat
()
112
{
113
return \CIMMessageParamAttach::PrepareAttach($this->
getValue
());
114
}
115
119
public
function
isValid
():
Result
120
{
121
$result
=
new
Result
();
122
123
if
($this->
isValid
&& (!isset($this->attach) || $this->attach->IsAllowSize()))
124
{
125
return
$result
;
126
}
127
128
return
$result
->addError(
new
ParamError
(
ParamError::ATTACH_ERROR
));
129
}
130
}
Bitrix\Im\V2\Message\Param\Attach\toPullFormat
toPullFormat()
Определения
Attach.php:111
Bitrix\Im\V2\Message\Param\Attach\setValue
setValue($value)
Определения
Attach.php:20
Bitrix\Im\V2\Message\Param\Attach\isValid
isValid()
Определения
Attach.php:119
Bitrix\Im\V2\Message\Param\Attach\saveJsonFilter
saveJsonFilter($value)
Определения
Attach.php:71
Bitrix\Im\V2\Message\Param\Attach\loadJsonFilter
loadJsonFilter($value)
Определения
Attach.php:80
Bitrix\Im\V2\Message\Param\Attach\$type
string $type
Определения
Attach.php:14
Bitrix\Im\V2\Message\Param\Attach\getValue
getValue()
Определения
Attach.php:47
Bitrix\Im\V2\Message\Param\Attach\saveValueFilter
saveValueFilter($value)
Определения
Attach.php:56
Bitrix\Im\V2\Message\Param\Attach\toRestFormat
toRestFormat()
Определения
Attach.php:103
Bitrix\Im\V2\Message\Param\ParamError
Определения
ParamError.php:9
Bitrix\Im\V2\Message\Param\ParamError\ATTACH_ERROR
const ATTACH_ERROR
Определения
ParamError.php:10
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\getDefaultValue
getDefaultValue()
Определения
Param.php:142
Bitrix\Main\ArgumentException
Определения
ArgumentException.php:9
Bitrix\Main\DB\Result
Определения
result.php:20
Bitrix\Main\Web\Json\decode
static decode($data)
Определения
json.php:50
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
Bitrix\Im\V2\Chat\Param
Bitrix\Im\V2\Chat\Param\TYPE_JSON
const TYPE_JSON
Определения
Param.php:20
Bitrix\Im\V2\Message\Attach
Определения
AttachService.php:3
Bitrix\Im\V2\Message\Param
Определения
Attach.php:3
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$val
$val
Определения
options.php:1793
bitrix
modules
im
lib
V2
Message
Param
Attach.php
Создано системой
1.14.0