/** * Loads configuration from CBitrixCloudOption * * @return CBitrixCloudCDNConfig * */ public function loadFromOptions() { $this->active = intval(CBitrixCloudOption::getOption("cdn_config_active")->getStringValue()); $this->expires = intval(CBitrixCloudOption::getOption("cdn_config_expire_time")->getStringValue()); $this->domain = CBitrixCloudOption::getOption("cdn_config_domain")->getStringValue(); $this->sites = CBitrixCloudOption::getOption("cdn_config_site")->getArrayValue(); $this->quota = CBitrixCloudCDNQuota::fromOption(CBitrixCloudOption::getOption("cdn_config_quota")); $this->classes = CBitrixCloudCDNClasses::fromOption(CBitrixCloudOption::getOption("cdn_class")); $this->server_groups = CBitrixCloudCDNServerGroups::fromOption(CBitrixCloudOption::getOption("cdn_server_group")); $this->locations = CBitrixCloudCDNLocations::fromOption(CBitrixCloudOption::getOption("cdn_location"), $this); return $this; }
/** * * @param CBitrixCloudOption $option * @return CBitrixCloudCDNServerGroups * */ public static function fromOption(CBitrixCloudOption $option) { $groups = new CBitrixCloudCDNServerGroups(); foreach ($option->getArrayValue() as $group_name => $servers) { $groups->addGroup(new CBitrixCloudCDNServerGroup($group_name, explode(",", $servers))); } return $groups; }