Conditions | 6 |
Paths | 26 |
Total Lines | 28 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 6.4689 |
Changes | 0 |
1 | <?php |
||
45 | public function read($filename) |
||
46 | 2 | { |
|
47 | $meta = new ValueBag(); |
||
48 | |||
49 | 2 | try { |
|
50 | 2 | $zip = new \ZipArchive(); |
|
51 | $result = $zip->open($filename); |
||
52 | 2 | ||
53 | 1 | if ($result === true) { |
|
54 | if ($zip->comment) { |
||
55 | $meta->set('zip.comment', new MetaValue($zip->comment)); |
||
56 | } |
||
57 | 1 | ||
58 | 1 | if ($zip->numFiles) { |
|
59 | 1 | $meta->set('zip.numFiles', new MetaValue($zip->numFiles)); |
|
60 | } |
||
61 | 1 | ||
62 | if ($zip->status) { |
||
63 | $meta->set('zip.status', new MetaValue($zip->status)); |
||
64 | } |
||
65 | 1 | ||
66 | 1 | $zip->close(); |
|
67 | 2 | } |
|
68 | } catch (\Exception $e) { |
||
|
|||
69 | } |
||
70 | 2 | ||
71 | return $meta; |
||
72 | } |
||
73 | } |
||
74 |