コード例 #1
3
ファイル: S3Storage.php プロジェクト: brick/brick
 /**
  * {@inheritdoc}
  */
 public function get($path)
 {
     try {
         $model = $this->s3->getObject(['Bucket' => $this->bucket, 'Key' => $path]);
         return (string) $model->get('Body');
     } catch (S3Exception $e) {
         if ($e->getAwsErrorCode() == 'NoSuchKey') {
             throw Exception\NotFoundException::pathNotFound($path, $e);
         }
         throw Exception\StorageException::getError($path, $e);
     }
 }
コード例 #2
0
ファイル: S3Storage.php プロジェクト: e-ruiz/brick
 /**
  * {@inheritdoc}
  */
 public function get($path)
 {
     try {
         $model = $this->s3->getObject(['Bucket' => $this->bucket, 'Key' => $path]);
         return (string) $model->get('Body');
     } catch (NoSuchKeyException $e) {
         throw Exception\NotFoundException::pathNotFound($path, $e);
     } catch (AwsExceptionInterface $e) {
         throw Exception\StorageException::getError($path, $e);
     }
 }
コード例 #3
0
ファイル: LocalStorage.php プロジェクト: brick/brick
 /**
  * {@inheritdoc}
  */
 public function delete($path)
 {
     try {
         $path = $this->getAbsolutePath($path);
         if (!$this->filesystem->exists($path)) {
             throw Exception\NotFoundException::pathNotFound($path);
         }
         $this->filesystem->delete($path, true);
     } catch (FileSystemException $e) {
         throw Exception\StorageException::deleteError($path, $e);
     }
 }