PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.0.1
Defender Security – Malware Scanner, Login Security & Firewall v3.0.1
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / thecodingmachine / safe / generated / zip.php

zip.php in Defender Security – Malware Scanner, Login Security & Firewall 3.0.1, at vendor/thecodingmachine/safe/generated/zip.php

72 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Safe;
4
5 use Safe\Exceptions\ZipException;
6
7 /**
8 * Closes the specified directory entry.
9 *
10 * @param resource $zip_entry A directory entry previously opened zip_entry_open.
11 * @throws ZipException
12 *
13 */
14 function zip_entry_close($zip_entry): void
15 {
16 error_clear_last();
17 $result = \zip_entry_close($zip_entry);
18 if ($result === false) {
19 throw ZipException::createFromPhpError();
20 }
21 }
22
23
24 /**
25 * Opens a directory entry in a zip file for reading.
26 *
27 * @param resource $zip A valid resource handle returned by zip_open.
28 * @param resource $zip_entry A directory entry returned by zip_read.
29 * @param string $mode Any of the modes specified in the documentation of
30 * fopen.
31 *
32 * Currently, mode is ignored and is always
33 * "rb". This is due to the fact that zip support
34 * in PHP is read only access.
35 * @throws ZipException
36 *
37 */
38 function zip_entry_open($zip, $zip_entry, string $mode = null): void
39 {
40 error_clear_last();
41 if ($mode !== null) {
42 $result = \zip_entry_open($zip, $zip_entry, $mode);
43 } else {
44 $result = \zip_entry_open($zip, $zip_entry);
45 }
46 if ($result === false) {
47 throw ZipException::createFromPhpError();
48 }
49 }
50
51
52 /**
53 * Reads from an open directory entry.
54 *
55 * @param resource $zip_entry A directory entry returned by zip_read.
56 * @param int $length The number of bytes to return.
57 *
58 * This should be the uncompressed length you wish to read.
59 * @return string Returns the data read, empty string on end of a file.
60 * @throws ZipException
61 *
62 */
63 function zip_entry_read($zip_entry, int $length = 1024): string
64 {
65 error_clear_last();
66 $result = \zip_entry_read($zip_entry, $length);
67 if ($result === false) {
68 throw ZipException::createFromPhpError();
69 }
70 return $result;
71 }
72