1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
notify.php
См. документацию.
1<?php
2namespace Bitrix\Rest;
3
4use Bitrix\Main\ArgumentException;
5use Bitrix\Main\ArgumentNullException;
6
7class Notify
8{
9 const NOTIFY_IM = 'im';
10 const NOTIFY_BOT = 'bot';
11
12 protected $type;
13 protected $userList = array();
14
18 protected $notifier = null;
19
20 public function __construct($notifyType, array $userList)
21 {
22 $this->setType($notifyType);
23 $this->setUserList($userList);
24 }
25
26 public function send($clientId, $token, $method, $message)
27 {
28 foreach($this->userList as $userId)
29 {
30 $this->getNotifier()->send($clientId, $userId, $token, $method, $message);
31 }
32 }
33
34 public function setType($notifyType)
35 {
36 if($notifyType == static::NOTIFY_IM || $notifyType == static::NOTIFY_BOT)
37 {
38 $this->type = $notifyType;
39 }
40 else
41 {
42 throw new ArgumentException('Wrong notify type', 'type');
43 }
44 }
45
46 public function getType()
47 {
48 return $this->type;
49 }
50
51 public function setUserList(array $userList)
52 {
53 if(count($userList) > 0)
54 {
55 $this->userList = $userList;
56 }
57 else
58 {
59 throw new ArgumentNullException('userList');
60 }
61 }
62
63 public function getUserList()
64 {
65 return $this->userList;
66 }
67
71 protected function getNotifier()
72 {
73 if(!$this->notifier)
74 {
75 switch($this->type)
76 {
77 case static::NOTIFY_IM:
78 $this->notifier = new NotifyIm();
79 break;
80 case static::NOTIFY_BOT:
81 $this->notifier = new NotifyIm();
82 break;
83 }
84 }
85
86 return $this->notifier;
87 }
88}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
Определения notify.php:8
__construct($notifyType, array $userList)
Определения notify.php:20
setUserList(array $userList)
Определения notify.php:51
send($clientId, $token, $method, $message)
Определения notify.php:26
const NOTIFY_IM
Определения notify.php:9
$userList
Определения notify.php:13
const NOTIFY_BOT
Определения notify.php:10
getType()
Определения notify.php:46
$type
Определения notify.php:12
setType($notifyType)
Определения notify.php:34
getNotifier()
Определения notify.php:71
$notifier
Определения notify.php:18
getUserList()
Определения notify.php:63
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$message
Определения payment.php:8
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$method
Определения index.php:27
$clientId
Определения seo_client.php:18