Beispiel #1
0
 /**
  *
  * @param string $name
  * @param string $value
  * @param CBitrixCloudCDNConfig $config
  * @return CBitrixCloudCDNLocation
  *
  */
 public static function fromOptionValue($name, $value, CBitrixCloudCDNConfig $config)
 {
     $values = unserialize($value);
     $proto = "";
     $prefixes = array();
     $services = array();
     if (is_array($values)) {
         if (isset($values["prefixes"]) && is_array($values["prefixes"])) {
             foreach ($values["prefixes"] as $prefix) {
                 $prefixes[] = $prefix;
             }
         }
         if (isset($values["services"]) && is_array($values["services"])) {
             $services = $values["services"];
         }
         if (isset($values["proto"])) {
             $proto = $values["proto"];
         }
     }
     $location = new CBitrixCloudCDNLocation($name, $proto, $prefixes);
     foreach ($services as $file_class => $server_group) {
         $location->addService($config->getClassByName($file_class), $config->getServerGroupByName($server_group));
     }
     return $location;
 }