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/sale/lib/delivery/requests/message/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sale/lib/delivery/requests/message/message.php
<?php

namespace Bitrix\Sale\Delivery\Requests\Message;

use Bitrix\Main\Type\DateTime;

/**
 * Class Message
 *
 * @package Bitrix\Sale\Delivery\Requests\Message
 * @internal
 */
final class Message
{
	public const TYPE_SHIPMENT_PICKUPED = 'SHIPMENT_PICKUPED';

	/** @var string */
	private $subject;

	/** @var string */
	private $body;

	/** @var Status */
	private $status;

	/** @var string */
	private $type;

	/** @var string|null */
	private $currency;

	/** @var array */
	private $moneyValues = [];

	/** @var array */
	private $dateValues = [];

	/**
	 * @return string|null
	 */
	public function getSubject(): ?string
	{
		return $this->subject;
	}

	/**
	 * @return string|null
	 */
	public function getBody(): ?string
	{
		return $this->body;
	}

	/**
	 * @return string
	 */
	public function getBodyForHtml(): string
	{
		$result = htmlspecialcharsbx($this->getBody());

		$moneyValues = $this->getMoneyValues();
		$currency = $this->getCurrency();
		if ($moneyValues && $currency)
		{
			$result = str_replace(
				array_keys($moneyValues),
				array_map(
					static function ($moneyValue) use ($currency)
					{
						return SaleFormatCurrency($moneyValue, $currency);
					},
					$this->getMoneyValues()
				),
				$result
			);
		}

		$dateValues = $this->getDateValues();
		if ($dateValues)
		{
			$result = str_replace(
				array_keys($dateValues),
				array_map(
					static function ($dateValue)
					{
						if (!isset($dateValue['VALUE']) || !isset($dateValue['FORMAT']))
						{
							return '';
						}

						return
							DateTime::createFromTimestamp((int)$dateValue['VALUE'])
								->toUserTime()
								->format($dateValue['FORMAT'])
						;
					},
					$dateValues
				),
				$result
			);
		}

		return $result;
	}

	/**
	 * @return Status|null
	 */
	public function getStatus(): ?Status
	{
		return $this->status;
	}

	/**
	 * @return string|null
	 */
	public function getType(): ?string
	{
		return $this->type;
	}

	/**
	 * @return string|null
	 */
	public function getCurrency(): ?string
	{
		return $this->currency;
	}

	/**
	 * @return array
	 */
	public function getMoneyValues(): array
	{
		return $this->moneyValues;
	}

	/**
	 * @return array
	 */
	public function getDateValues(): array
	{
		return $this->dateValues;
	}

	/**
	 * @param string $subject
	 * @return Message
	 */
	public function setSubject(string $subject): Message
	{
		$this->subject = $subject;

		return $this;
	}

	/**
	 * @param string $body
	 * @return Message
	 */
	public function setBody(string $body): Message
	{
		$this->body = $body;

		return $this;
	}

	/**
	 * @param Status $status
	 * @return Message
	 */
	public function setStatus(Status $status): Message
	{
		$this->status = $status;

		return $this;
	}

	/**
	 * @param string $type
	 * @return Message
	 */
	public function setType(string $type): Message
	{
		$this->type = $type;

		return $this;
	}

	/**
	 * @param string $key
	 * @param float $value
	 * @return $this
	 */
	public function addMoneyValue(string $key, float $value): Message
	{
		$this->moneyValues[$key] = $value;

		return $this;
	}

	/**
	 * @param string $currency
	 * @return Message
	 */
	public function setCurrency(string $currency): Message
	{
		$this->currency = $currency;

		return $this;
	}

	/**
	 * @param string $key
	 * @param int $value
	 * @param string $format
	 * @return $this
	 */
	public function addDateValue(string $key, int $value, string $format): Message
	{
		$this->dateValues[$key] = [
			'VALUE' => $value,
			'FORMAT' => $format,
		];

		return $this;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit