| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.2098 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | public function replaceFile($oldFilepath, $newFilepath) |
||
| 34 | { |
||
| 35 | 1 | if (!file_exists($oldFilepath)) { |
|
| 36 | throw new Exception("File $oldFilepath does not exist"); |
||
| 37 | } |
||
| 38 | 1 | if (!file_exists($newFilepath)) { |
|
| 39 | throw new Exception("File $newFilepath does not exist"); |
||
| 40 | } |
||
| 41 | |||
| 42 | 1 | unlink($oldFilepath); |
|
| 43 | 1 | rename($newFilepath, $oldFilepath); |
|
| 44 | 1 | } |
|
| 45 | } |
||
| 46 |