public function getFile(array &$file, &$continue) { $this->init(); try { $blob = $this->blobProxy->getBlob($this->container, $file['id']); $file['data'] = stream_get_contents($blob->getContentStream()); $continue = false; } catch (ServiceException $ex) { $continue = true; } }
/** * @inheritdoc */ public function readStream($path) { /** @var GetBlobResult $blobResult */ $blobResult = $this->client->getBlob($this->container, $path); $properties = $blobResult->getProperties(); return $this->normalizeBlobProperties($path, $properties) + ['stream' => $blobResult->getContentStream()]; }
/** * {@inheritdoc} */ public function readStream($path) { $path = $this->applyPathPrefix($path); /** @var \WindowsAzure\Blob\Models\GetBlobResult $blobResult */ $blobResult = $this->client->getBlob($this->container, $path); $properties = $blobResult->getProperties(); return $this->normalizeBlobProperties($path, $properties) + ['stream' => $blobResult->getContentStream()]; }
/** * {@inheritDoc} */ public function read($key) { $this->init(); try { $blob = $this->blobProxy->getBlob($this->containerName, $key); return stream_get_contents($blob->getContentStream()); } catch (ServiceException $e) { $this->failIfContainerNotFound($e, sprintf('read key "%s"', $key)); return false; } }
/** * @param \Gaufrette\Adapter\AzureBlobStorage\BlobProxyFactoryInterface $blobProxyFactory * @param \WindowsAzure\Blob\Internal\IBlob $blobProxy */ public function it_should_not_mask_exception_when_read($blobProxyFactory, $blobProxy) { $blobProxy->getBlob('containerName', 'filename')->shouldBeCalled()->willThrow(new \RuntimeException('read')); $blobProxyFactory->create()->shouldBeCalled()->willReturn($blobProxy); $this->shouldThrow(new \RuntimeException('read'))->duringRead('filename'); }