Пример #1
0
 /**
  * Get a single specific container.
  *
  * This loads only the named container from the remote server.
  *
  * @param string $name
  *   The name of the container to load.
  * @retval HPCloud::Storage::ObjectStorage::Container
  * @return \HPCloud\Storage\ObjectStorage\Container
  *   A container.
  * @throws HPCloud::Transport::FileNotFoundException
  *   if the named container is not found on the remote server.
  */
 public function container($name)
 {
     $url = $this->url() . '/' . rawurlencode($name);
     $data = $this->req($url, 'HEAD', FALSE);
     $status = $data->status();
     if ($status == 200 || $status == 204) {
         $container = Container::newFromResponse($name, $data, $this->token(), $this->url());
         if (isset($this->cdnContainers[$name])) {
             $cdnList = $this->cdnContainers[$name];
             $container->useCDN($cdnList['url'], $cdnList['sslUrl']);
         }
         return $container;
     }
     // If we get here, it's not a 404, and it's not an expected 2xx.
     throw new \HPCloud\Exception("Unknown status: {$status}");
 }