403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/rest/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/rest/lib/notify.php
<?php
namespace Bitrix\Rest;

use Bitrix\Main\ArgumentException;
use Bitrix\Main\ArgumentNullException;

class Notify
{
	const NOTIFY_IM = 'im';
	const NOTIFY_BOT = 'bot';

	protected $type;
	protected $userList = array();

	/**
	 * @var INotify
	 */
	protected $notifier = null;

	public function __construct($notifyType, array $userList)
	{
		$this->setType($notifyType);
		$this->setUserList($userList);
	}

	public function send($clientId, $token, $method, $message)
	{
		foreach($this->userList as $userId)
		{
			$this->getNotifier()->send($clientId, $userId, $token, $method, $message);
		}
	}

	public function setType($notifyType)
	{
		if($notifyType == static::NOTIFY_IM || $notifyType == static::NOTIFY_BOT)
		{
			$this->type = $notifyType;
		}
		else
		{
			throw new ArgumentException('Wrong notify type', 'type');
		}
	}

	public function getType()
	{
		return $this->type;
	}

	public function setUserList(array $userList)
	{
		if(count($userList) > 0)
		{
			$this->userList = $userList;
		}
		else
		{
			throw new ArgumentNullException('userList');
		}
	}

	public function getUserList()
	{
		return $this->userList;
	}

	/**
	 * @return INotify
	 */
	protected function getNotifier()
	{
		if(!$this->notifier)
		{
			switch($this->type)
			{
				case static::NOTIFY_IM:
					$this->notifier = new NotifyIm();
					break;
				case static::NOTIFY_BOT:
					$this->notifier = new NotifyIm();
					break;
			}
		}

		return $this->notifier;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit