Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
factory.php
1<?php
10namespace Bitrix\Sender\Message;
11
14
21{
27 protected static function getInterface()
28 {
29 return iBase::class;
30 }
31
32 protected static function getClasses()
33 {
34 return [
35 iBase::EVENT_NAME => Integration\EventHandler::onSenderMessageList(),
36 ];
37 }
38
44 public static function getAdsMessages()
45 {
46 $list = [];
47 foreach (static::getMessages() as $message)
48 {
49 if (!($message instanceof iAds))
50 {
51 continue;
52 }
53
54 $list[] = $message;
55 }
56
57 return $list;
58 }
59
65 public static function getMarketingMessages()
66 {
67 $list = [];
68 foreach (static::getMessages() as $message)
69 {
70 if (!($message instanceof iMarketing))
71 {
72 continue;
73 }
74
75 $list[] = $message;
76 }
77
78 return $list;
79 }
80
86 public static function getTolokaMessages()
87 {
88 $list = [];
89 foreach (static::getMessages() as $message)
90 {
91 if (!($message instanceof iToloka))
92 {
93 continue;
94 }
95
96 $list[] = $message;
97 }
98
99 return $list;
100 }
101
107 public static function getYandexMessages(bool $withToloka): array
108 {
109 $list = [];
110 foreach (static::getMessages() as $message)
111 {
112 if (!$message instanceof iYandex)
113 {
114 continue;
115 }
116 if (!$withToloka && $message instanceof iToloka)
117 {
118 continue;
119 }
120
121 $list[] = $message;
122 }
123
124 return $list;
125 }
126
132 public static function getMailingMessages()
133 {
134 $list = [];
135 foreach (static::getMessages() as $message)
136 {
137 if (!($message instanceof iMailable))
138 {
139 continue;
140 }
141
142 $list[] = $message;
143 }
144
145 return $list;
146 }
147
153 public static function getReturnCustomerMessages()
154 {
155 $list = [];
156 foreach (static::getMessages() as $message)
157 {
158 if (!($message instanceof iReturnCustomer))
159 {
160 continue;
161 }
162
163 $list[] = $message;
164 }
165
166 return $list;
167 }
168
174 public static function getAdsMessageCodes()
175 {
176 return array_map(
177 function ($message) {
179 return $message->getCode();
180 },
181 static::getAdsMessages()
182 );
183 }
184
190 public static function getMarketingMessageCodes()
191 {
192 return array_map(
193 function ($message) {
195 return $message->getCode();
196 },
197 static::getMarketingMessages()
198 );
199 }
200
206 public static function getMailingMessageCodes()
207 {
208 return array_map(
209 function ($message) {
211 return $message->getCode();
212 },
213 static::getMailingMessages()
214 );
215 }
216
222 public static function getTolokaMessageCodes()
223 {
224 return array_map(
225 function ($message) {
227 return $message->getCode();
228 },
229 static::getTolokaMessages()
230 );
231 }
232
238 public static function getReturnCustomerMessageCodes()
239 {
240 return array_map(
241 function ($message) {
243 return $message->getCode();
244 },
245 static::getReturnCustomerMessages()
246 );
247 }
248
254 public static function getMessages()
255 {
256 return static::getObjectInstances(static::getInterface());
257 }
258
266 public static function getMessage($code)
267 {
268 return static::getObjectInstance(static::getInterface(), $code);
269 }
270}
static getYandexMessages(bool $withToloka)
Definition factory.php:107