| Conditions | 4 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 6 | protected function checkForDuplicate($name) |
|
| 37 | { |
||
| 38 | 6 | if(Storage::disk($this->disk)->exists($this->path.DIRECTORY_SEPARATOR.$name)) |
|
| 39 | { |
||
| 40 | 2 | $parts = pathinfo($name); |
|
| 41 | 2 | $ext = isset($parts['extension']) ? ('.'.$parts['extension']) : ''; |
|
| 42 | 2 | $base = $parts['filename']; |
|
| 43 | 2 | $number = 0; |
|
| 44 | |||
| 45 | do |
||
| 46 | { |
||
| 47 | 2 | $name = $base.'('.++$number.')'.$ext; |
|
| 48 | 2 | } while(Storage::disk($this->disk)->exists($this->path.DIRECTORY_SEPARATOR.$name)); |
|
| 49 | } |
||
| 50 | |||
| 51 | 6 | return $name; |
|
| 52 | } |
||
| 54 |