| Total Complexity | 9 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 7 | ||
| Bugs | 1 | Features | 3 |
| 1 | <?php |
||
| 8 | class Upload extends Resource |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @return bool |
||
| 12 | */ |
||
| 13 | public function save(): bool |
||
| 14 | { |
||
| 15 | if($this->response()->type === 'error') |
||
| 16 | { |
||
| 17 | return false; |
||
| 18 | } |
||
| 19 | if(!$this->getFiles()) |
||
| 20 | { |
||
| 21 | return false; |
||
| 22 | } |
||
| 23 | if($this->upload()) { |
||
| 24 | $this->setResponse(200, "success", "upload performed successfully", "upload", $this->getData()); |
||
| 25 | return true; |
||
| 26 | } |
||
| 27 | return false; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string|null $path |
||
| 32 | * @return bool |
||
| 33 | */ |
||
| 34 | public function delete(?string $path = null): bool |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return object |
||
| 53 | */ |
||
| 54 | public function response(): object |
||
| 57 | } |
||
| 58 | } |