1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
jsonfield.php
См. документацию.
1<?php
2namespace Bitrix\Sale\Archive\Recovery;
3
4use Bitrix\Main;
5
9class JsonField extends PackedField
10{
11 public function tryUnpack()
12 {
13 $result = new Main\Result();
14 try
15 {
16 $value = Main\Web\Json::decode($this->packedValue);
17 if (!$value)
18 {
19 $result->addError(new Main\Error('Unavailable value for unpacking'));
20 }
21 }
22 catch (\Exception $e)
23 {
24 $result->addError(new Main\Error('Unavailable value for unpacking'));
25 }
26
27 return $result;
28 }
29
30 public function unpack()
31 {
32 try
33 {
34 $unpacked = Main\Web\Json::decode($this->packedValue);
35 if (!is_array($unpacked))
36 return null;
37
38 return $this->formatResult($unpacked);
39 }
40 catch (\Exception $e)
41 {
42 return null;
43 }
44 }
45
46 private function formatResult(array $fields)
47 {
48 foreach ($fields as &$field)
49 {
50 if (is_array($field))
51 {
52 $field = $this->formatResult($field);
53 }
54 elseif (CheckDateTime($field))
55 {
56 $field = new Main\Type\DateTime($field);
57 }
58 }
59
60 return $fields;
61 }
62}
Определения error.php:15
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
CheckDateTime($datetime, $format=false)
Определения tools.php:398
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$fields
Определения yandex_run.php:501