| @@ 303-320 (lines=18) @@ | ||
| 300 | /** |
|
| 301 | * {@inheritdoc} |
|
| 302 | */ |
|
| 303 | public function setMetadata($key, $content) |
|
| 304 | { |
|
| 305 | $this->init(); |
|
| 306 | ||
| 307 | try { |
|
| 308 | $this->blobProxy->setBlobMetadata($this->containerName, $key, $content); |
|
| 309 | } catch (ServiceException $e) { |
|
| 310 | $errorCode = $this->getErrorCodeFromServiceException($e); |
|
| 311 | ||
| 312 | throw new \RuntimeException(sprintf( |
|
| 313 | 'Failed to set metadata for blob "%s" in container "%s": %s (%s).', |
|
| 314 | $key, |
|
| 315 | $this->containerName, |
|
| 316 | $e->getErrorText(), |
|
| 317 | $errorCode |
|
| 318 | ), $e->getCode()); |
|
| 319 | } |
|
| 320 | } |
|
| 321 | ||
| 322 | /** |
|
| 323 | * {@inheritdoc} |
|
| @@ 325-344 (lines=20) @@ | ||
| 322 | /** |
|
| 323 | * {@inheritdoc} |
|
| 324 | */ |
|
| 325 | public function getMetadata($key) |
|
| 326 | { |
|
| 327 | $this->init(); |
|
| 328 | ||
| 329 | try { |
|
| 330 | $properties = $this->blobProxy->getBlobProperties($this->containerName, $key); |
|
| 331 | ||
| 332 | return $properties->getMetadata(); |
|
| 333 | } catch (ServiceException $e) { |
|
| 334 | $errorCode = $this->getErrorCodeFromServiceException($e); |
|
| 335 | ||
| 336 | throw new \RuntimeException(sprintf( |
|
| 337 | 'Failed to get metadata for blob "%s" in container "%s": %s (%s).', |
|
| 338 | $key, |
|
| 339 | $this->containerName, |
|
| 340 | $e->getErrorText(), |
|
| 341 | $errorCode |
|
| 342 | ), $e->getCode()); |
|
| 343 | } |
|
| 344 | } |
|
| 345 | ||
| 346 | /** |
|
| 347 | * Lazy initialization, automatically called when some method is called after construction. |
|