Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
builderconnectionfromdm.php
1<?php
2
4
10use Bitrix\Dav\Internals\EO_DavConnection;
17
19{
21 protected $data;
22
23
27 public function __construct(EO_DavConnection $davConnection)
28 {
29 parent::__construct($davConnection);
30 }
31
32
33 protected function getId(): int
34 {
35 return $this->data->getId();
36 }
37
38 protected function getName(): string
39 {
40 return $this->data->getName();
41 }
42
48 protected function getLastSyncTime(): ?Date
49 {
50 return $this->data->getSynchronized()
51 ? new Date($this->data->getSynchronized())
52 : null;
53 }
54
58 protected function getToken(): ?string
59 {
60 return $this->data->getSyncToken() ?? null;
61 }
62
66 protected function getStatus(): ?string
67 {
68 return $this->data->getLastResult() ?? null;
69 }
70
76 protected function getVendor(): ?VendorInterface
77 {
78 return new Vendor([
79 'ACCOUNT_TYPE' => $this->data->getAccountType(),
80 'SERVER_SCHEME' => $this->data->getServerScheme(),
81 'SERVER_HOST' => $this->data->getServerHost(),
82 'SERVER_PORT' => $this->data->getServerPort(),
83 'SERVER_USERNAME' => $this->data->getServerUsername(),
84 'SERVER_PASSWORD' => $this->data->getServerPassword(),
85 'SERVER_PATH' => $this->data->getServerPath(),
86 ]);
87 }
88
95 protected function getOwner(): ?Role
96 {
97 try
98 {
99 return Helper::getRole(
100 $this->data->getEntityId(),
101 $this->data->getEntityType()
102 );
103 }
104 catch (BaseException $e)
105 {
106 return null;
107 }
108 }
109
113 protected function isDeleted(): bool
114 {
115 return $this->data['IS_DELETED'] ?? false;
116 }
117
121 protected function getSyncStatus(): ?string
122 {
123 return $this->data->getSyncStatus();
124 }
125
131 protected function getNextSyncTry(): ?Date
132 {
133 return $this->data->getNextSyncTry()
134 ? new Date($this->data->getSynchronized())
135 : null;
136 }
137}