| @@ 160-174 (lines=15) @@ | ||
| 157 | * {@inheritdoc} |
|
| 158 | * @throws \RuntimeException |
|
| 159 | */ |
|
| 160 | public function read($key) |
|
| 161 | { |
|
| 162 | $this->init(); |
|
| 163 | list($containerName, $key) = $this->tokenizeKey($key); |
|
| 164 | ||
| 165 | try { |
|
| 166 | $blob = $this->blobProxy->getBlob($containerName, $key); |
|
| 167 | ||
| 168 | return stream_get_contents($blob->getContentStream()); |
|
| 169 | } catch (ServiceException $e) { |
|
| 170 | $this->failIfContainerNotFound($e, sprintf('read key "%s"', $key), $containerName); |
|
| 171 | ||
| 172 | return false; |
|
| 173 | } |
|
| 174 | } |
|
| 175 | ||
| 176 | /** |
|
| 177 | * {@inheritdoc} |
|
| @@ 281-295 (lines=15) @@ | ||
| 278 | * {@inheritdoc} |
|
| 279 | * @throws \RuntimeException |
|
| 280 | */ |
|
| 281 | public function mtime($key) |
|
| 282 | { |
|
| 283 | $this->init(); |
|
| 284 | list($containerName, $key) = $this->tokenizeKey($key); |
|
| 285 | ||
| 286 | try { |
|
| 287 | $properties = $this->blobProxy->getBlobProperties($containerName, $key); |
|
| 288 | ||
| 289 | return $properties->getProperties()->getLastModified()->getTimestamp(); |
|
| 290 | } catch (ServiceException $e) { |
|
| 291 | $this->failIfContainerNotFound($e, sprintf('read mtime for key "%s"', $key), $containerName); |
|
| 292 | ||
| 293 | return false; |
|
| 294 | } |
|
| 295 | } |
|
| 296 | ||
| 297 | /** |
|
| 298 | * {@inheritdoc} |
|
| @@ 301-315 (lines=15) @@ | ||
| 298 | * {@inheritdoc} |
|
| 299 | * @throws \RuntimeException |
|
| 300 | */ |
|
| 301 | public function delete($key) |
|
| 302 | { |
|
| 303 | $this->init(); |
|
| 304 | list($containerName, $key) = $this->tokenizeKey($key); |
|
| 305 | ||
| 306 | try { |
|
| 307 | $this->blobProxy->deleteBlob($containerName, $key); |
|
| 308 | ||
| 309 | return true; |
|
| 310 | } catch (ServiceException $e) { |
|
| 311 | $this->failIfContainerNotFound($e, sprintf('delete key "%s"', $key), $containerName); |
|
| 312 | ||
| 313 | return false; |
|
| 314 | } |
|
| 315 | } |
|
| 316 | ||
| 317 | /** |
|
| 318 | * {@inheritdoc} |
|