Esempio n. 1
3
 /**
  * {@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);
     }
 }
Esempio n. 2
0
 /**
  * {@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);
     }
 }
Esempio n. 3
0
 /**
  * {@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);
     }
 }