예제 #1
0
 /**
  * Get a key/value array of metadata for the given path.
  *
  * @param  string $path
  * @param  array $options
  * @return array An associative array of key/value pairs specifying the metadata for this object.
  *                  If no metadata exists, an empty array is returned.
  */
 public function fetchMetadata($path, $options = null)
 {
     $result = $this->rackspace->getMetadataObject($this->container, $path);
     if (!$this->rackspace->isSuccessful()) {
         throw new Exception\RuntimeException('Error on fetch metadata: ' . $this->rackspace->getErrorMsg());
     }
     $metadata = array();
     if (isset($result['metadata'])) {
         $metadata = $result['metadata'];
     }
     // delete the self::DELETE_METADATA_KEY - this is a trick to remove all
     // the metadata information of an object (see deleteMetadata).
     // Rackspace doesn't have an API to remove the metadata of an object
     unset($metadata[self::DELETE_METADATA_KEY]);
     return $metadata;
 }