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/yandex.market/lib/data/ |
Upload File : |
<?php namespace Yandex\Market\Data; use Bitrix\Main; use Yandex\Market; class Vat { use Market\Reference\Concerns\HasLang; protected static $type; protected static function includeMessages() { Main\Localization\Loc::loadMessages(__FILE__); } public static function getTitle($vat) { if (is_int($vat) && $vat > 1) { $vat = static::convertForService($vat); } if (preg_match('/^VAT_(\d+)(?:_(\d+))?$/', $vat, $matches)) { $firstPercent = (int)$matches[1]; $secondPercent = (string)$matches[2]; if ($secondPercent !== '') { $format = $firstPercent . '/' . $secondPercent; } else { $format = $firstPercent . '%'; } $result = static::getLang('DATA_VAT_FORMAT', [ '#FORMAT#' => $format ], $format); } else { $result = static::getLang('DATA_VAT_' . $vat, null, $vat); } return $result; } public static function convertForService($rate) { $type = static::getType(); return $type->format($rate); } /** * @return Market\Type\VatType */ protected static function getType() { if (static::$type === null) { static::$type = new Market\Type\VatType(); } return static::$type; } }