@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | protected $file; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var \ZipArchive |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var \ZipArchive |
|
| 43 | + */ |
|
| 44 | 44 | protected $zip; |
| 45 | 45 | |
| 46 | 46 | public function __construct($targetFile) |
@@ -48,33 +48,33 @@ discard block |
||
| 48 | 48 | $this->file = $targetFile; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Sets an option, among the available options: |
|
| 53 | - * |
|
| 54 | - * <ul> |
|
| 55 | - * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li> |
|
| 56 | - * </ul> |
|
| 57 | - * |
|
| 58 | - * @param string $name |
|
| 59 | - * @param mixed $value |
|
| 60 | - * @return ZIPHelper |
|
| 61 | - */ |
|
| 51 | + /** |
|
| 52 | + * Sets an option, among the available options: |
|
| 53 | + * |
|
| 54 | + * <ul> |
|
| 55 | + * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li> |
|
| 56 | + * </ul> |
|
| 57 | + * |
|
| 58 | + * @param string $name |
|
| 59 | + * @param mixed $value |
|
| 60 | + * @return ZIPHelper |
|
| 61 | + */ |
|
| 62 | 62 | public function setOption($name, $value) |
| 63 | 63 | { |
| 64 | 64 | $this->options[$name] = $value; |
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Adds a file to the zip. By default, the file is stored |
|
| 70 | - * with the same name in the root of the zip. Use the optional |
|
| 71 | - * parameter to change the location in the zip. |
|
| 72 | - * |
|
| 73 | - * @param string $filePath |
|
| 74 | - * @param string $zipPath |
|
| 75 | - * @throws ZIPHelper_Exception |
|
| 76 | - * @return bool |
|
| 77 | - */ |
|
| 68 | + /** |
|
| 69 | + * Adds a file to the zip. By default, the file is stored |
|
| 70 | + * with the same name in the root of the zip. Use the optional |
|
| 71 | + * parameter to change the location in the zip. |
|
| 72 | + * |
|
| 73 | + * @param string $filePath |
|
| 74 | + * @param string $zipPath |
|
| 75 | + * @throws ZIPHelper_Exception |
|
| 76 | + * @return bool |
|
| 77 | + */ |
|
| 78 | 78 | public function addFile($filePath, $zipPath=null) |
| 79 | 79 | { |
| 80 | 80 | $this->open(); |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | readfile($this->file); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - /** |
|
| 248 | - * Like {@link ZIPHelper::download()}, but deletes the |
|
| 249 | - * file after sending it to the browser. |
|
| 250 | - * |
|
| 251 | - * @param string|NULL $fileName Override the ZIP's file name for the download |
|
| 252 | - * @see ZIPHelper::download() |
|
| 253 | - */ |
|
| 247 | + /** |
|
| 248 | + * Like {@link ZIPHelper::download()}, but deletes the |
|
| 249 | + * file after sending it to the browser. |
|
| 250 | + * |
|
| 251 | + * @param string|NULL $fileName Override the ZIP's file name for the download |
|
| 252 | + * @see ZIPHelper::download() |
|
| 253 | + */ |
|
| 254 | 254 | public function downloadAndDelete($fileName=null) |
| 255 | 255 | { |
| 256 | 256 | $this->download($fileName); |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | FileHelper::deleteFile($fileName); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - /** |
|
| 262 | - * Extracts all files and folders from the zip to the |
|
| 263 | - * target folder. If no folder is specified, the files |
|
| 264 | - * are extracted into the same folder as the zip itself. |
|
| 265 | - * |
|
| 266 | - * @param string $outputFolder |
|
| 267 | - * @return boolean |
|
| 268 | - */ |
|
| 261 | + /** |
|
| 262 | + * Extracts all files and folders from the zip to the |
|
| 263 | + * target folder. If no folder is specified, the files |
|
| 264 | + * are extracted into the same folder as the zip itself. |
|
| 265 | + * |
|
| 266 | + * @param string $outputFolder |
|
| 267 | + * @return boolean |
|
| 268 | + */ |
|
| 269 | 269 | public function extractAll($outputFolder=null) |
| 270 | 270 | { |
| 271 | 271 | if(empty($outputFolder)) { |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | |
| 281 | - /** |
|
| 282 | - * @return \ZipArchive |
|
| 283 | - */ |
|
| 281 | + /** |
|
| 282 | + * @return \ZipArchive |
|
| 283 | + */ |
|
| 284 | 284 | public function getArchive() |
| 285 | 285 | { |
| 286 | 286 | $this->open(); |
@@ -288,14 +288,14 @@ discard block |
||
| 288 | 288 | return $this->zip; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - /** |
|
| 292 | - * JSON encodes the specified data and adds the json as |
|
| 293 | - * a file in the ZIP archive. |
|
| 294 | - * |
|
| 295 | - * @param mixed $data |
|
| 296 | - * @param string $zipPath |
|
| 297 | - * @return boolean |
|
| 298 | - */ |
|
| 291 | + /** |
|
| 292 | + * JSON encodes the specified data and adds the json as |
|
| 293 | + * a file in the ZIP archive. |
|
| 294 | + * |
|
| 295 | + * @param mixed $data |
|
| 296 | + * @param string $zipPath |
|
| 297 | + * @return boolean |
|
| 298 | + */ |
|
| 299 | 299 | public function addJSON($data, $zipPath) |
| 300 | 300 | { |
| 301 | 301 | return $this->addString( |