| @@ 324-332 (lines=9) @@ | ||
| 321 | * @param \ZipArchive $zip |
|
| 322 | * @param string $file |
|
| 323 | */ |
|
| 324 | public function addFileToZip(\ZipArchive $zip, $file) |
|
| 325 | { |
|
| 326 | if (!$zip->addFile($file)) { |
|
| 327 | $zip->unchangeAll(); |
|
| 328 | $zip->close(); |
|
| 329 | ||
| 330 | throw new RuntimeException(sprintf('unable to add %s to the zip file', $file)); |
|
| 331 | } |
|
| 332 | } |
|
| 333 | ||
| 334 | /** |
|
| 335 | * Is public for PHP 5.3 compatibility, should be private |
|
| @@ 340-348 (lines=9) @@ | ||
| 337 | * @param \ZipArchive $zip |
|
| 338 | * @param string $dir |
|
| 339 | */ |
|
| 340 | public function addEmptyDir(\ZipArchive $zip, $dir) |
|
| 341 | { |
|
| 342 | if (!$zip->addEmptyDir($dir)) { |
|
| 343 | $zip->unchangeAll(); |
|
| 344 | $zip->close(); |
|
| 345 | ||
| 346 | throw new RuntimeException(sprintf('unable to add %s to the zip file', $dir)); |
|
| 347 | } |
|
| 348 | } |
|
| 349 | ||
| 350 | /** |
|
| 351 | * Flushes changes to the archive |
|