Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | function _zip($string, $state) { |
||
22 | // ZIP can be created without temporary file by gzcompress - see PEAR File_Archive |
||
23 | $this->data .= $string; |
||
24 | if ($state & PHP_OUTPUT_HANDLER_END) { |
||
25 | $zip = new ZipArchive; |
||
26 | $zipFile = tempnam('', 'zip'); |
||
27 | $zip->open($zipFile, ZipArchive::OVERWRITE); // php://output is not supported |
||
28 | $zip->addFromString($this->filename, $this->data); |
||
29 | $zip->close(); |
||
30 | $return = file_get_contents($zipFile); |
||
31 | unlink($zipFile); |
||
32 | return $return; |
||
33 | } |
||
34 | return ''; |
||
35 | } |
||
36 | |||
46 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.