public static function newFromJSON($jsonArray, $token, $url) {
    $container = new Container($jsonArray['name']);

    $container->baseUrl = $url;

    $container->url = $url . '/' . rawurlencode($jsonArray['name']);
    $container->token = $token;

    // Access to count and bytes is basically controlled. This is is to
    // prevent a local copy of the object from getting out of sync with
    // the remote copy.
    if (!empty($jsonArray['count'])) {
      $container->count = $jsonArray['count'];
    }

    if (!empty($jsonArray['bytes'])) {
      $container->bytes = $jsonArray['bytes'];
    }

    //syslog(LOG_WARNING, print_r($jsonArray, TRUE));

    return $container;
  }
public static function newFromJSON($jsonArray, $token, $url) {
    $container = new Container($jsonArray['name']);

    $container->baseUrl = $url;

    $container->url = $url . '/' . rawurlencode($jsonArray['name']);
    $container->token = $token;

    // Access to count and bytes is basically controlled. This is is to
    // prevent a local copy of the object from getting out of sync with
    // the remote copy.
    if (!empty($jsonArray['count'])) {
      $container->count = $jsonArray['count'];
    }

    if (!empty($jsonArray['bytes'])) {
      $container->bytes = $jsonArray['bytes'];
    }

    //syslog(LOG_WARNING, print_r($jsonArray, TRUE));

    return $container;
  }
public static function newFromJSON ( $ jsonArray , $ token , $ url ) { $ container = new Container ( $ jsonArray [ 'name' ] ) ; $ container -> baseUrl = $ url ; $ container -> url = $ url . '/' . rawurlencode ( $ jsonArray [ 'name' ] ) ; $ container -> token = $ token ; // Access to count and bytes is basically controlled. This is is to // prevent a local copy of the object from getting out of sync with // the remote copy. if ( ! empty ( $ jsonArray [ 'count' ] ) ) { $ container -> count = $ jsonArray [ 'count' ] ; } if ( ! empty ( $ jsonArray [ 'bytes' ] ) ) { $ container -> bytes = $ jsonArray [ 'bytes' ] ; } //syslog(LOG_WARNING, print_r($jsonArray, TRUE)); return $ container ; }
Create a new Container from JSON data.

This is used in lieue of a standard constructor when
fetching containers from ObjectStorage.

@param array $jsonArray
An associative array as returned by json_decode($foo, TRUE);
@param string $token
The auth token.
@param string $url
The base URL. The container name is automatically appended to
this at construction time.

@retval HPCloud::Storage::ObjectStorage::Comtainer
@return \HPCloud\Storage\ObjectStorage\Container
A new container object.
Create a new Container from JSON data .