Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
Initiator.php
1<?php
2
4
7
9{
13 public function getFromList(): array
14 {
15 $fromList = [];
16 if (!$this->supportChecker->canUse())
17 {
18 return $fromList;
19 }
20
21 $externalSender = new ExternalSender(
22 $this->optionManager->getOption(InternalOption::API_KEY, ''),
24 );
25 $apiResult = $externalSender->callExternalMethod('smsSubject/');
26 if (!$apiResult->isSuccess())
27 {
28 return $fromList;
29 }
30
31 foreach ($apiResult->getData() as $subjectInfo)
32 {
33 if ($subjectInfo['active'])
34 {
35 $fromList[] = [
36 'id' => $subjectInfo['subject'],
37 'name' => $subjectInfo['subject'],
38 ];
39 }
40 }
41
42 return $fromList;
43 }
44
49 public function isCorrectFrom($from): bool
50 {
51 $fromList = $this->getFromList();
52 foreach ($fromList as $item)
53 {
54 if ($from === $item['id'])
55 {
56 return true;
57 }
58 }
59 return false;
60 }
61
62}