| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function downloadFile($url, $filename, $overwrite = false) |
||
| 15 | { |
||
| 16 | if (file_exists($filename) && !$overwrite) { |
||
| 17 | return; |
||
| 18 | } |
||
| 19 | |||
| 20 | $this->prepareDirectory(dirname($filename)); |
||
| 21 | |||
| 22 | if (!$filedata = @file_get_contents($url)) { |
||
| 23 | throw new \RuntimeException(sprintf('Unable to download archive "%s"', $url)); |
||
| 24 | } |
||
| 25 | |||
| 26 | file_put_contents($filename, $filedata); |
||
| 27 | } |
||
| 28 | |||
| 40 |