| @@ 164-178 (lines=15) @@ | ||
| 161 | * @throws \RuntimeException |
|
| 162 | * @throws \InvalidArgumentException |
|
| 163 | */ |
|
| 164 | public function read($key) |
|
| 165 | { |
|
| 166 | $this->init(); |
|
| 167 | list($containerName, $key) = $this->tokenizeKey($key); |
|
| 168 | ||
| 169 | try { |
|
| 170 | $blob = $this->blobProxy->getBlob($containerName, $key); |
|
| 171 | ||
| 172 | return stream_get_contents($blob->getContentStream()); |
|
| 173 | } catch (ServiceException $e) { |
|
| 174 | $this->failIfContainerNotFound($e, sprintf('read key "%s"', $key), $containerName); |
|
| 175 | ||
| 176 | return false; |
|
| 177 | } |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|
| 181 | * {@inheritdoc} |
|
| @@ 295-309 (lines=15) @@ | ||
| 292 | * @throws \RuntimeException |
|
| 293 | * @throws \InvalidArgumentException |
|
| 294 | */ |
|
| 295 | public function mtime($key) |
|
| 296 | { |
|
| 297 | $this->init(); |
|
| 298 | list($containerName, $key) = $this->tokenizeKey($key); |
|
| 299 | ||
| 300 | try { |
|
| 301 | $properties = $this->blobProxy->getBlobProperties($containerName, $key); |
|
| 302 | ||
| 303 | return $properties->getProperties()->getLastModified()->getTimestamp(); |
|
| 304 | } catch (ServiceException $e) { |
|
| 305 | $this->failIfContainerNotFound($e, sprintf('read mtime for key "%s"', $key), $containerName); |
|
| 306 | ||
| 307 | return false; |
|
| 308 | } |
|
| 309 | } |
|
| 310 | ||
| 311 | /** |
|
| 312 | * {@inheritdoc} |
|
| @@ 336-350 (lines=15) @@ | ||
| 333 | * @throws \RuntimeException |
|
| 334 | * @throws \InvalidArgumentException |
|
| 335 | */ |
|
| 336 | public function delete($key) |
|
| 337 | { |
|
| 338 | $this->init(); |
|
| 339 | list($containerName, $key) = $this->tokenizeKey($key); |
|
| 340 | ||
| 341 | try { |
|
| 342 | $this->blobProxy->deleteBlob($containerName, $key); |
|
| 343 | ||
| 344 | return true; |
|
| 345 | } catch (ServiceException $e) { |
|
| 346 | $this->failIfContainerNotFound($e, sprintf('delete key "%s"', $key), $containerName); |
|
| 347 | ||
| 348 | return false; |
|
| 349 | } |
|
| 350 | } |
|
| 351 | ||
| 352 | /** |
|
| 353 | * {@inheritdoc} |
|