@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | 'WriteThreshold' => 100 |
37 | 37 | ); |
38 | 38 | |
39 | - /** |
|
40 | - * @var string |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var string |
|
41 | + */ |
|
42 | 42 | protected $file; |
43 | 43 | |
44 | - /** |
|
45 | - * @var \ZipArchive |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var \ZipArchive |
|
46 | + */ |
|
47 | 47 | protected $zip; |
48 | 48 | |
49 | 49 | public function __construct(string $targetFile) |
@@ -51,35 +51,35 @@ discard block |
||
51 | 51 | $this->file = $targetFile; |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Sets an option, among the available options: |
|
56 | - * |
|
57 | - * <ul> |
|
58 | - * <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> |
|
59 | - * </ul> |
|
60 | - * |
|
61 | - * @param string $name |
|
62 | - * @param mixed $value |
|
63 | - * @return ZIPHelper |
|
64 | - */ |
|
54 | + /** |
|
55 | + * Sets an option, among the available options: |
|
56 | + * |
|
57 | + * <ul> |
|
58 | + * <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> |
|
59 | + * </ul> |
|
60 | + * |
|
61 | + * @param string $name |
|
62 | + * @param mixed $value |
|
63 | + * @return ZIPHelper |
|
64 | + */ |
|
65 | 65 | public function setOption(string $name, $value) : ZIPHelper |
66 | 66 | { |
67 | 67 | $this->options[$name] = $value; |
68 | 68 | return $this; |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * Adds a file to the zip. By default, the file is stored |
|
73 | - * with the same name in the root of the zip. Use the optional |
|
74 | - * parameter to change the location in the zip. |
|
75 | - * |
|
76 | - * @param string $filePath |
|
77 | - * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root. |
|
78 | - * @throws ZIPHelper_Exception |
|
79 | - * @return bool |
|
80 | - * |
|
81 | - * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST |
|
82 | - */ |
|
71 | + /** |
|
72 | + * Adds a file to the zip. By default, the file is stored |
|
73 | + * with the same name in the root of the zip. Use the optional |
|
74 | + * parameter to change the location in the zip. |
|
75 | + * |
|
76 | + * @param string $filePath |
|
77 | + * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root. |
|
78 | + * @throws ZIPHelper_Exception |
|
79 | + * @return bool |
|
80 | + * |
|
81 | + * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST |
|
82 | + */ |
|
83 | 83 | public function addFile(string $filePath, ?string $zipPath=null) : bool |
84 | 84 | { |
85 | 85 | $this->open(); |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | return $fileName; |
256 | 256 | } |
257 | 257 | |
258 | - /** |
|
259 | - * Like {@link ZIPHelper::download()}, but deletes the |
|
260 | - * file after sending it to the browser. |
|
261 | - * |
|
262 | - * @param string|NULL $fileName Override the ZIP's file name for the download |
|
263 | - * @see ZIPHelper::download() |
|
264 | - */ |
|
258 | + /** |
|
259 | + * Like {@link ZIPHelper::download()}, but deletes the |
|
260 | + * file after sending it to the browser. |
|
261 | + * |
|
262 | + * @param string|NULL $fileName Override the ZIP's file name for the download |
|
263 | + * @see ZIPHelper::download() |
|
264 | + */ |
|
265 | 265 | public function downloadAndDelete(?string $fileName=null) |
266 | 266 | { |
267 | 267 | $this->download($fileName); |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | FileHelper::deleteFile($this->file); |
270 | 270 | } |
271 | 271 | |
272 | - /** |
|
273 | - * Extracts all files and folders from the zip to the |
|
274 | - * target folder. If no folder is specified, the files |
|
275 | - * are extracted into the same folder as the zip itself. |
|
276 | - * |
|
277 | - * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder. |
|
278 | - * @return boolean |
|
279 | - */ |
|
272 | + /** |
|
273 | + * Extracts all files and folders from the zip to the |
|
274 | + * target folder. If no folder is specified, the files |
|
275 | + * are extracted into the same folder as the zip itself. |
|
276 | + * |
|
277 | + * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder. |
|
278 | + * @return boolean |
|
279 | + */ |
|
280 | 280 | public function extractAll(?string $outputFolder=null) : bool |
281 | 281 | { |
282 | 282 | if(empty($outputFolder)) { |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | |
292 | - /** |
|
293 | - * @return \ZipArchive |
|
294 | - */ |
|
292 | + /** |
|
293 | + * @return \ZipArchive |
|
294 | + */ |
|
295 | 295 | public function getArchive() : \ZipArchive |
296 | 296 | { |
297 | 297 | $this->open(); |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | return $this->zip; |
300 | 300 | } |
301 | 301 | |
302 | - /** |
|
303 | - * JSON encodes the specified data and adds the json as |
|
304 | - * a file in the ZIP archive. |
|
305 | - * |
|
306 | - * @param mixed $data |
|
307 | - * @param string $zipPath |
|
308 | - * @return boolean |
|
309 | - */ |
|
302 | + /** |
|
303 | + * JSON encodes the specified data and adds the json as |
|
304 | + * a file in the ZIP archive. |
|
305 | + * |
|
306 | + * @param mixed $data |
|
307 | + * @param string $zipPath |
|
308 | + * @return boolean |
|
309 | + */ |
|
310 | 310 | public function addJSON($data, $zipPath) |
311 | 311 | { |
312 | 312 | return $this->addString( |