54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Jinove\Vinoteca;
|
|
|
|
use Bitrix\Main\Config\Configuration;
|
|
use Bitrix\Main\SystemException;
|
|
|
|
final class Config
|
|
{
|
|
private const MODULE_ID = "jinove.vinoteca";
|
|
|
|
public static function basketSiteId(): string
|
|
{
|
|
$siteId = (string)(self::get("basket")["siteId"] ?? "");
|
|
if ($siteId === "") {
|
|
throw new SystemException("Basket site is not configured in " . self::MODULE_ID . "/.settings.php");
|
|
}
|
|
|
|
return $siteId;
|
|
}
|
|
|
|
public static function host(): string
|
|
{
|
|
return (string)(self::get("site")["host"] ?? "");
|
|
}
|
|
|
|
public static function ageExitUrl(): string
|
|
{
|
|
return (string)(self::get("site")["ageExitUrl"] ?? "");
|
|
}
|
|
|
|
public static function languages(): array
|
|
{
|
|
return (array)(self::get("site")["languages"] ?? []);
|
|
}
|
|
|
|
public static function contacts(): array
|
|
{
|
|
return self::get("contacts");
|
|
}
|
|
|
|
public static function iblockId(string $code): int
|
|
{
|
|
return (int)(self::get("site")["iblocks"][$code] ?? 0);
|
|
}
|
|
|
|
private static function get(string $name): array
|
|
{
|
|
return (array)Configuration::getInstance(self::MODULE_ID)->get($name);
|
|
}
|
|
}
|