public static function newFromServiceCatalog($catalog, $token, $region = CDN::DEFAULT_REGION) {
    $c = count($catalog);
    for ($i = 0; $i < $c; ++$i) {
      if ($catalog[$i]['type'] == self::SERVICE_TYPE) {
        foreach ($catalog[$i]['endpoints'] as $endpoint) {
          if (isset($endpoint['publicURL']) && $endpoint['region'] == $region) {
            /*
            $parts = parse_url($endpoint['publicURL']);
            $base = $parts['scheme'] . '://' . $parts['host'];
            if (isset($parts['port'])) {
              $base .= ':' . $parts['port'];
            }
            //$base = $endpoint['publicURL'];
            $cdn = new CDN($token, $base, $endpoint['tenantId']);
            //$cdn->url = $endpoint['publicURL'];
             */
            $cdn = new CDN($token, $endpoint['publicURL']);

            return $cdn;
          }
        }
      }
    }
    return FALSE;
  }