1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Attach.php
См. документацию.
1<?php
2
4
8
9class 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 {
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}
setValue($value)
Определения Attach.php:20
saveJsonFilter($value)
Определения Attach.php:71
loadJsonFilter($value)
Определения Attach.php:80
string $type
Определения Attach.php:14
saveValueFilter($value)
Определения Attach.php:56
unsetValue()
Определения Param.php:223
getDefaultValue()
Определения Param.php:142
Определения result.php:20
static decode($data)
Определения json.php:50
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
const TYPE_JSON
Определения Param.php:20
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$val
Определения options.php:1793