| @@ 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} |
|
| @@ 293-307 (lines=15) @@ | ||
| 290 | * @throws \RuntimeException |
|
| 291 | * @throws \InvalidArgumentException |
|
| 292 | */ |
|
| 293 | public function mtime($key) |
|
| 294 | { |
|
| 295 | $this->init(); |
|
| 296 | list($containerName, $key) = $this->tokenizeKey($key); |
|
| 297 | ||
| 298 | try { |
|
| 299 | $properties = $this->blobProxy->getBlobProperties($containerName, $key); |
|
| 300 | ||
| 301 | return $properties->getProperties()->getLastModified()->getTimestamp(); |
|
| 302 | } catch (ServiceException $e) { |
|
| 303 | $this->failIfContainerNotFound($e, sprintf('read mtime for key "%s"', $key), $containerName); |
|
| 304 | ||
| 305 | return false; |
|
| 306 | } |
|
| 307 | } |
|
| 308 | ||
| 309 | /** |
|
| 310 | * {@inheritdoc} |
|
| @@ 314-328 (lines=15) @@ | ||
| 311 | * @throws \RuntimeException |
|
| 312 | * @throws \InvalidArgumentException |
|
| 313 | */ |
|
| 314 | public function delete($key) |
|
| 315 | { |
|
| 316 | $this->init(); |
|
| 317 | list($containerName, $key) = $this->tokenizeKey($key); |
|
| 318 | ||
| 319 | try { |
|
| 320 | $this->blobProxy->deleteBlob($containerName, $key); |
|
| 321 | ||
| 322 | return true; |
|
| 323 | } catch (ServiceException $e) { |
|
| 324 | $this->failIfContainerNotFound($e, sprintf('delete key "%s"', $key), $containerName); |
|
| 325 | ||
| 326 | return false; |
|
| 327 | } |
|
| 328 | } |
|
| 329 | ||
| 330 | /** |
|
| 331 | * {@inheritdoc} |
|