Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
43 | public function addFromString($localname, $contents) |
||
44 | { |
||
45 | $pathData = pathinfo($localname); |
||
46 | |||
47 | $hFile = fopen($this->tmpDir.'/'.$pathData['basename'], "wb"); |
||
48 | fwrite($hFile, $contents); |
||
49 | fclose($hFile); |
||
50 | |||
51 | $res = $this->oPclZip->add($this->tmpDir.'/'.$pathData['basename'], PCLZIP_OPT_REMOVE_PATH, $this->tmpDir, PCLZIP_OPT_ADD_PATH, $pathData['dirname']); |
||
52 | if ($res == 0) { |
||
53 | throw new \Exception("Error zipping files : " . $this->oPclZip->errorInfo(true)); |
||
54 | } |
||
55 | unlink($this->tmpDir.'/'.$pathData['basename']); |
||
56 | return $this; |
||
57 | } |
||
58 | } |
||
59 |