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