Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
push.php
1<?php
2
4
7
8class Push
9{
13 private string $entityType;
17 private int $entityId;
21 private string $channelId;
25 private string $resourceId;
29 private Date $expireDate;
33 private ?string $processStatus = null;
37 private ?Date $firstPushDate = null;
38
42 public function getEntityType(): string
43 {
44 return $this->entityType;
45 }
46
51 public function setEntityType(string $entityType): Push
52 {
53 $this->entityType = $entityType;
54 return $this;
55 }
56
60 public function getEntityId(): int
61 {
62 return $this->entityId;
63 }
64
69 public function setEntityId(int $entityId): Push
70 {
71 $this->entityId = $entityId;
72 return $this;
73 }
74
78 public function getChannelId(): string
79 {
80 return $this->channelId;
81 }
82
87 public function setChannelId(string $channelId): Push
88 {
89 $this->channelId = $channelId;
90 return $this;
91 }
92
96 public function getResourceId(): string
97 {
98 return $this->resourceId;
99 }
100
105 public function setResourceId(string $resourceId): Push
106 {
107 $this->resourceId = $resourceId;
108 return $this;
109 }
110
114 public function getExpireDate(): Date
115 {
116 return $this->expireDate;
117 }
118
123 public function setExpireDate(Date $expireDate): Push
124 {
125 $this->expireDate = $expireDate;
126 return $this;
127 }
128
132 public function isExpired(): bool
133 {
134 return ((int)$this->expireDate->format('U')) < time();
135 }
136
140 public function isProcessed(): bool
141 {
142 return in_array(
143 $this->processStatus,
144 [
146 Dictionary::PUSH_STATUS_PROCESS['unprocessed'],
147 ],
148 true
149 );
150 }
151
155 public function isBlocked(): bool
156 {
157 return $this->processStatus === Dictionary::PUSH_STATUS_PROCESS['block'];
158 }
159
163 public function isUnprocessed(): bool
164 {
165 return $this->processStatus === Dictionary::PUSH_STATUS_PROCESS['unprocessed'];
166 }
167
171 public function isUnblocked(): bool
172 {
173 return $this->processStatus === Dictionary::PUSH_STATUS_PROCESS['unblocked'];
174 }
175
180 public function setProcessStatus(string $processStatus): Push
181 {
182 if (in_array($processStatus, Dictionary::PUSH_STATUS_PROCESS, true))
183 {
184 $this->processStatus = $processStatus;
185 }
186
187 return $this;
188 }
189
193 public function getProcessStatus(): ?string
194 {
195 return $this->processStatus;
196 }
197
201 public function getFirstPushDate(): ?Date
202 {
203 return $this->firstPushDate;
204 }
205
210 public function setFirstPushDate(?Date $firstPushDate): Push
211 {
212 $this->firstPushDate = $firstPushDate;
213 return $this;
214 }
215}
setEntityType(string $entityType)
Definition push.php:51
setProcessStatus(string $processStatus)
Definition push.php:180
setChannelId(string $channelId)
Definition push.php:87
setExpireDate(Date $expireDate)
Definition push.php:123
setEntityId(int $entityId)
Definition push.php:69
setFirstPushDate(?Date $firstPushDate)
Definition push.php:210
setResourceId(string $resourceId)
Definition push.php:105