| Total Complexity | 4 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | trait LocalFileDeletion |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var bool Enable/disable deleting the local file after it's been uploaded |
||
| 9 | */ |
||
| 10 | protected $deleteLocalFileAfterUpload = false; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Enable deleting the local file after it's been uploaded. |
||
| 14 | * |
||
| 15 | * @return $this |
||
| 16 | */ |
||
| 17 | public function deleteLocalFileAfterUpload(): self |
||
| 18 | { |
||
| 19 | $this->deleteLocalFileAfterUpload = true; |
||
| 20 | |||
| 21 | return $this; |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Delete the local file path if post upload file deletion is enabled. |
||
| 26 | * |
||
| 27 | * @param string $localFilePath |
||
| 28 | */ |
||
| 29 | protected function deleteLocalFileIfEnabled(string $localFilePath): void |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Determine if deleting the local file after it's been uploaded is enabled. |
||
| 38 | * |
||
| 39 | * @return bool |
||
| 40 | */ |
||
| 41 | private function isLocalFileDeletingEnabled(): bool |
||
| 46 |