Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
RegionHelper.php
1<?php
3
4abstract class RegionHelper
5{
6 public const REGION_RU = ['ru', 'by'];
7 public const REGION_OPTION_FORCE = 'force_region';
8 public const REGION_PHRASE_POSTFIX = '_IO';
9
10 public static function isInternational(): bool
11 {
12 $region = \Bitrix\Main\Config\Option::get('messageservice', self::REGION_OPTION_FORCE, false);
13 if (!$region)
14 {
15 $region = \Bitrix\Main\Application::getInstance()->getLicense()->getRegion();
16 \Bitrix\Main\Config\Option::set('messageservice', self::REGION_OPTION_FORCE, $region);
17 }
18
19 return !in_array($region, self::REGION_RU, true);
20 }
21
22 public static function getPhrase(string $phraseCode): string
23 {
24 return self::isInternational() ? $phraseCode . self::REGION_PHRASE_POSTFIX : $phraseCode;
25 }
26
27 abstract static function getApiEndPoint();
28}