Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
builderconnectionfromarray.php
1<?php
2
4
16
18{
19
20 public function __construct(array $data)
21 {
22 parent::__construct($data);
23 }
24
25 protected function getId(): int
26 {
27 return $this->data['ID'];
28 }
29
30 protected function getName(): string
31 {
32 return $this->data['NAME'] ?? '';
33 }
34
40 protected function getLastSyncTime(): ?Date
41 {
42 // TODO: move date format to helper
43 return $this->data['SYNCHRONIZED']
44 ? new Date(new DateTime($this->data['SYNCHRONIZED'], 'Y-m-d H:i:s'))
45 : null;
46 }
47
51 protected function getToken(): ?string
52 {
53 return $this->data['SYNC_TOKEN'] ?? null;
54 }
55
59 protected function getStatus(): ?string
60 {
61 return $this->data['LAST_RESULT'];
62 }
63
69 protected function getVendor(): ?VendorInterface
70 {
71 return new Vendor($this->data);
72 }
73
81 protected function getOwner(): ?Role
82 {
83 try
84 {
85 return Helper::getRole(
86 $this->data['ENTITY_ID'],
87 $this->data['ENTITY_TYPE']
88 );
89 }
90 catch (BaseException $e)
91 {
92 return null;
93 }
94 }
95
99 protected function isDeleted(): bool
100 {
101 return $this->data['IS_DELETED'] === 'Y';
102 }
103
109 protected function getNextSyncTry(): ?Date
110 {
111 // TODO: move date format to helper
112 return $this->data['NEXT_SYNC_TRY']
113 ? new Date(new DateTime($this->data['NEXT_SYNC_TRY'], 'Y-m-d H:i:s'))
114 : null;
115 }
116}