@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | const ERROR_OPENING_ZIP_FILE = 338003; |
32 | 32 | |
33 | - const ERROR_CANNOT_SAVE_FILE_TO_DISK =338004; |
|
33 | + const ERROR_CANNOT_SAVE_FILE_TO_DISK = 338004; |
|
34 | 34 | |
35 | 35 | protected $options = array( |
36 | 36 | 'WriteThreshold' => 100 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @throws ZIPHelper_Exception |
76 | 76 | * @return bool |
77 | 77 | */ |
78 | - public function addFile($filePath, $zipPath=null) |
|
78 | + public function addFile($filePath, $zipPath = null) |
|
79 | 79 | { |
80 | 80 | $this->open(); |
81 | 81 | |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | |
121 | 121 | protected function open() |
122 | 122 | { |
123 | - if($this->open) { |
|
123 | + if ($this->open) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | - if(!isset($this->zip)) { |
|
127 | + if (!isset($this->zip)) { |
|
128 | 128 | $this->zip = new \ZipArchive(); |
129 | 129 | } |
130 | 130 | |
131 | 131 | $flag = null; |
132 | - if(!file_exists($this->file)) { |
|
132 | + if (!file_exists($this->file)) { |
|
133 | 133 | $flag = \ZipArchive::CREATE; |
134 | 134 | } |
135 | 135 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $this->fileTracker++; |
171 | 171 | |
172 | - if($this->options['WriteThreshold'] < 1) { |
|
172 | + if ($this->options['WriteThreshold'] < 1) { |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | protected function close() |
184 | 184 | { |
185 | - if(!$this->open) { |
|
185 | + if (!$this->open) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | throw new ZIPHelper_Exception( |
191 | 191 | 'Could not save ZIP file to disk', |
192 | 192 | sprintf( |
193 | - 'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, ' . |
|
194 | - 'including adding files that do not exist on disk, trying to create an empty zip, ' . |
|
193 | + 'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, '. |
|
194 | + 'including adding files that do not exist on disk, trying to create an empty zip, '. |
|
195 | 195 | 'or trying to save to a directory that does not exist.', |
196 | 196 | $this->file |
197 | 197 | ), |
@@ -228,17 +228,17 @@ discard block |
||
228 | 228 | * @see ZIPHelper::downloadAndDelete() |
229 | 229 | * @throws ZIPHelper_Exception |
230 | 230 | */ |
231 | - public function download($fileName=null) |
|
231 | + public function download($fileName = null) |
|
232 | 232 | { |
233 | 233 | $this->save(); |
234 | 234 | |
235 | - if(empty($fileName)) { |
|
235 | + if (empty($fileName)) { |
|
236 | 236 | $fileName = basename($this->file); |
237 | 237 | } |
238 | 238 | |
239 | 239 | header('Content-type: application/zip'); |
240 | - header('Content-Disposition: attachment; filename=' . $fileName); |
|
241 | - header('Content-length: ' . filesize($this->file)); |
|
240 | + header('Content-Disposition: attachment; filename='.$fileName); |
|
241 | + header('Content-length: '.filesize($this->file)); |
|
242 | 242 | header('Pragma: no-cache'); |
243 | 243 | header('Expires: 0'); |
244 | 244 | readfile($this->file); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param string|NULL $fileName Override the ZIP's file name for the download |
252 | 252 | * @see ZIPHelper::download() |
253 | 253 | */ |
254 | - public function downloadAndDelete($fileName=null) |
|
254 | + public function downloadAndDelete($fileName = null) |
|
255 | 255 | { |
256 | 256 | $this->download($fileName); |
257 | 257 | |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | * @param string $outputFolder |
267 | 267 | * @return boolean |
268 | 268 | */ |
269 | - public function extractAll($outputFolder=null) |
|
269 | + public function extractAll($outputFolder = null) |
|
270 | 270 | { |
271 | - if(empty($outputFolder)) { |
|
271 | + if (empty($outputFolder)) { |
|
272 | 272 | $outputFolder = dirname($this->file); |
273 | 273 | } |
274 | 274 |