/** * * @param CDataXMLNode $node * @return CBitrixCloudCDNClass * */ public static function fromXMLNode(CDataXMLNode $node) { $name = $node->getAttribute("name"); $extensions = array(); $nodeExtensions = $node->elementsByName("extension"); foreach ($nodeExtensions as $nodeExtension) { $extensions[] = $nodeExtension->textContent(); } return new CBitrixCloudCDNClass($name, $extensions); }
/** * * @param CDataXMLNode $node * @return CBitrixCloudCDNServerGroup * */ public static function fromXMLNode(CDataXMLNode $node) { $name = $node->getAttribute("name"); $servers = array(); $nodeServers = $node->elementsByName("name"); foreach ($nodeServers as $nodeServer) { $servers[] = $nodeServer->textContent(); } return new CBitrixCloudCDNServerGroup($name, $servers); }
/** * * @param CDataXMLNode $node * @return CBitrixCloudCDNQuota * */ public static function fromXMLNode(CDataXMLNode $node) { $quota = new CBitrixCloudCDNQuota(); $quota->setExpires(strtotime($node->getAttribute("expires"))); $allow_nodes = $node->elementsByName("allow"); foreach ($allow_nodes as $allow_node) { $quota->setAllowedSize(self::parseSize($allow_node->textContent())); } $traffic_nodes = $node->elementsByName("traffic"); foreach ($traffic_nodes as $traffic_node) { $quota->setTrafficSize(self::parseSize($traffic_node->textContent())); } return $quota; }
/** * * @param CDataXMLNode $node * @param CBitrixCloudCDNConfig $config * @return CBitrixCloudCDNLocation * */ public static function fromXMLNode(CDataXMLNode $node, CBitrixCloudCDNConfig $config) { $name = $node->getAttribute("name"); $proto = $node->getAttribute("proto"); $prefixes = array(); $nodePrefixes = $node->elementsByName("prefix"); foreach ($nodePrefixes as $nodePrefix) { $prefixes[] = $nodePrefix->textContent(); } $location = new CBitrixCloudCDNLocation($name, $proto, $prefixes); $nodeServices = $node->elementsByName("service"); foreach ($nodeServices as $nodeService) { $file_class = $config->getClassByName($nodeService->getAttribute("class")); $server_group = $config->getServerGroupByName($nodeService->getAttribute("servergroup")); $location->addService($file_class, $server_group); } return $location; }