| Total Complexity | 4 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class CloudStorage |
||
| 12 | { |
||
| 13 | use LocalFileDeletion; |
||
| 14 | use UploadStreaming; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var string AWS S3 file key |
||
| 18 | */ |
||
| 19 | protected $s3Key; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string Storage S3 cloud disk name |
||
| 23 | */ |
||
| 24 | protected $disk; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * S3 constructor. |
||
| 28 | * |
||
| 29 | * @param string $s3Key |
||
| 30 | */ |
||
| 31 | public function __construct(string $s3Key) |
||
| 32 | { |
||
| 33 | $this->s3Key = $s3Key; |
||
| 34 | $this->disk = config('filesystem.cloud', 's3'); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Retrieve the S3 key (useful in conjunctions with `autocompletePath()` method). |
||
| 39 | * |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | public function getKey(): string |
||
| 43 | { |
||
| 44 | return $this->s3Key; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Set the filesystem disk. |
||
| 49 | * |
||
| 50 | * @param string $disk |
||
| 51 | * @return $this |
||
| 52 | */ |
||
| 53 | public function setDisk(string $disk): self |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Retrieve a Filesystem instance for the specified disk. |
||
| 62 | * |
||
| 63 | * @return Filesystem|FilesystemAdapter |
||
| 64 | */ |
||
| 65 | protected function storageDisk(): FilesystemAdapter |
||
| 68 | } |
||
| 69 | } |
||
| 70 |