• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/businesssuite/configuration/facebook/config.php
  • Класс: BitrixSeoBusinessSuiteConfigurationFacebookConfig
  • Вызов: Config::load
static function load(): IConfig
{
	if(!self::$current)
	{
		$cache = Application::getInstance()->getManagedCache();
		if ($cache->read(self::FACEBOOK_BUSINESS_CONFIG_TLL,self::FACEBOOK_BUSINESS_CONFIG_CACHE_ID))
		{
			self::$current = self::create();
			self::$current->value = $cache->get(self::FACEBOOK_BUSINESS_CONFIG_CACHE_ID);
		}
		elseif (
			($adapter = ServiceAdapter::loadFacebookService())
			&& ($response = $adapter->getConfig()->get())
			&& $response->isSuccess()
			&& $data = $response->fetch()
		)
		{
			self::$current = array_reduce(
				static::getFieldCodes(),
				function(IConfig $instance, string $code) use ($data)
				{
					if($value = $data[mb_strtoupper($code)])
					{
						$instance->set($code,$value);
					}
					return $instance;
				},
				self::create()
			);
			$cache->set(self::FACEBOOK_BUSINESS_CONFIG_CACHE_ID,self::$current->value);
		}
		else
		{
			throw new ExceptionConfigLoadException("can't load current fbe configuration");
		}
	}
	return self::$current;
}