Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
buildersectionconnectionfromdm.php
1<?php
2
4
11use Bitrix\Calendar\Internals\EO_SectionConnection;
14use DateTime;
15
17{
18
19 private EO_SectionConnection $link;
20
24 public function __construct(EO_SectionConnection $link)
25 {
26 $this->link = $link;
27 }
28
32 public function build()
33 {
34 return (new SectionConnection())
35 ->setActive($this->getIsActive())
36 ->setId($this->getId())
37 ->setLastSyncDate($this->getLastSyncDate())
38 ->setLastSyncStatus($this->getLastSyncStatus())
39 ->setPageToken($this->getPageToken())
40 ->setSection($this->getSection())
41 ->setSyncToken($this->getSyncToken())
42 ->setVersionId($this->getVersionId())
43 ->setVendorSectionId($this->getVendorSectionId())
44 ->setConnection($this->getConnection())
45 ;
46 }
47
51 private function getIsActive(): bool
52 {
53 return $this->link->getActive();
54 }
55
59 private function getId(): int
60 {
61 return $this->link->getId();
62 }
63
68 private function getLastSyncDate(): Date
69 {
70 return new Date(Util::getDateObject(
71 $this->link->getLastSyncDate(),
72 false,
73 (new DateTime)->getTimezone()->getName()
74 ));
75 }
76
80 private function getLastSyncStatus(): ?string
81 {
82 return $this->link->getLastSyncStatus();
83 }
84
88 private function getPageToken(): ?string
89 {
90 return $this->link->getPageToken();
91 }
92
96 private function getSection(): ?Section
97 {
98 if ($section = $this->link->getSection())
99 {
100 return (new SectionBuilderFromDataManager($section))->build();
101 }
102
103 return null;
104 }
105
109 private function getSyncToken(): ?string
110 {
111 return $this->link->getSyncToken();
112 }
113
117 private function getVersionId(): ?string
118 {
119 return $this->link->getVersionId();
120 }
121
125 private function getVendorSectionId(): ?string
126 {
127 return $this->link->getVendorSectionId();
128 }
129
133 private function getConnection(): ?Connection
134 {
135 if ($connection = $this->link->getConnection())
136 {
137 return (new BuilderConnectionFromDM($connection))->build();
138 }
139
140 return null;
141 }
142
143}
static getDateObject(string $date=null, ?bool $fullDay=true, ?string $tz='UTC')
Definition util.php:102