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/pull/lib/dto/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/pull/lib/dto/message.php
<?php

namespace Bitrix\Pull\DTO;

use Bitrix\Pull\Common;

class Message implements \JsonSerializable
{
	public array $userList = [];
	public array $channelList = [];
	public ?array $body;
	public ?string $type;
	public array $userParams; // map: userId => {user specific params}
	public array $dictionary; // map: key => value
	public int $expiry;

	public static function fromEvent(array $arrayFields): Message
	{
		$instance = new static();
		$instance->userList = $arrayFields['users'] ?? [];
		$instance->channelList = $arrayFields['channels'] ?? [];

		$body = $arrayFields['event'];
		if (is_array($body['user_params']) && !empty($body['user_params']))
		{
			$instance->userParams = $arrayFields['event']['user_params'];
		}
		if (is_array($body['dictionary']) && !empty($body['dictionary']))
		{
			$instance->dictionary = $arrayFields['event']['dictionary'];
		}
		$instance->expiry = is_int($body['expiry']) && $body['expiry'] > 0 ? $body['expiry'] : 86400;
		// for statistics
		$messageType = "{$body['module_id']}_{$body['command']}";
		$messageType = preg_replace("/[^\w]/", "", $messageType);
		$instance->type = $messageType;

		unset($body['user_params']);
		unset($body['dictionary']);
		unset($body['expiry']);

		$instance->body = $body;

		return $instance;
	}

	public function jsonSerialize(): array
	{
		$result = [];
		if (!empty($this->channelList))
		{
			$result['channelList'] = $this->channelList;
		}
		if (!empty($this->userList))
		{
			$result['userList'] = $this->userList;
		}
		if (isset($this->body))
		{
			$result['body'] = $this->body;
			Common::recursiveConvertDateToString($result['body']);
		}
		if (isset($this->userParams))
		{
			$result['user_params'] = $this->userParams;
		}
		if (isset($this->dictionary))
		{
			$result['dictionary'] = $this->dictionary;
		}
		if (isset($this->expiry))
		{
			$result['expiry'] = $this->expiry;
		}
		if (isset($this->type))
		{
			$result['type'] = $this->type;
		}

		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit