| Conditions | 4 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function save(Http\FileUpload $fileUpload, $path = '') |
||
| 26 | { |
||
| 27 | if (!$fileUpload->isOk()) { |
||
| 28 | throw new FileUploadFailedException($fileUpload->getName(), $fileUpload->getError()); |
||
| 29 | } elseif ($path) { |
||
| 30 | $path = trim($path, '\/') . DIRECTORY_SEPARATOR; |
||
| 31 | } |
||
| 32 | |||
| 33 | do { |
||
| 34 | $relativePath = $path . $this->createUniqueName($fileUpload); |
||
| 35 | } while ($this->driver->isFileExists($relativePath)); |
||
| 36 | |||
| 37 | $this->driver->save($fileUpload, $relativePath); |
||
| 38 | |||
| 39 | return $relativePath; |
||
| 40 | } |
||
| 41 | |||
| 56 |