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