xref: /PHP-8.0/ext/zip/php_zip.stub.php (revision 389d1130)
1<?php
2
3/** @generate-function-entries */
4
5/**
6 * @return resource|int|false
7 * @deprecated
8 */
9function zip_open(string $filename) {}
10
11/**
12 * @param resource $zip
13 * @deprecated
14 */
15function zip_close($zip): void {}
16
17/**
18 * @param resource $zip
19 * @return resource|false
20 * @deprecated
21 */
22function zip_read($zip) {}
23
24/**
25 * @param resource $zip_dp
26 * @param resource $zip_entry
27 * @deprecated
28 */
29function zip_entry_open($zip_dp, $zip_entry, string $mode = "rb"): bool {}
30
31/**
32 * @param resource $zip_entry
33 * @deprecated
34 */
35function zip_entry_close($zip_entry): bool {}
36
37/**
38 * @param resource $zip_entry
39 * @deprecated
40 */
41function zip_entry_read($zip_entry, int $len = 1024): string|false {}
42
43/**
44 * @param resource $zip_entry
45 * @deprecated
46 */
47function zip_entry_name($zip_entry): string|false {}
48
49/**
50 * @param resource $zip_entry
51 * @deprecated
52 */
53function zip_entry_compressedsize($zip_entry): int|false {}
54
55/**
56 * @param resource $zip_entry
57 * @deprecated
58 */
59function zip_entry_filesize($zip_entry): int|false {}
60
61/**
62 * @param resource $zip_entry
63 * @deprecated
64 */
65function zip_entry_compressionmethod($zip_entry): string|false {}
66
67class ZipArchive
68{
69    /** @return bool|int */
70    public function open(string $filename, int $flags = 0) {}
71
72    /** @return bool */
73    public function setPassword(string $password) {}
74
75    /** @return bool */
76    public function close() {}
77
78    /** @return int */
79    public function count() {}
80
81    /** @return string */
82    public function getStatusString() {}
83
84    /** @return bool */
85    public function addEmptyDir(string $dirname, int $flags = 0) {}
86
87    /** @return bool */
88    public function addFromString(string $name, string $content, int $flags = ZipArchive::FL_OVERWRITE) {}
89
90    /** @return bool */
91    public function addFile(string $filepath, string $entryname = "", int $start = 0, int $length = 0, int $flags = ZipArchive::FL_OVERWRITE) {}
92
93    /** @return bool */
94    public function replaceFile(string $filepath, int $index, int $start = 0, int $length = 0, int $flags = 0) {}
95
96    /** @return array|false */
97    public function addGlob(string $pattern, int $flags = 0, array $options = []) {}
98
99    /** @return array|false */
100    public function addPattern(string $pattern, string $path = ".", array $options = []) {}
101
102    /** @return bool */
103    public function renameIndex(int $index, string $new_name) {}
104
105    /** @return bool */
106    public function renameName(string $name, string $new_name) {}
107
108    /** @return bool */
109    public function setArchiveComment(string $comment) {}
110
111    /** @return string|false */
112    public function getArchiveComment(int $flags = 0) {}
113
114    /** @return bool */
115    public function setCommentIndex(int $index, string $comment) {}
116
117    /** @return bool */
118    public function setCommentName(string $name, string $comment) {}
119
120#ifdef HAVE_SET_MTIME
121    /** @return bool */
122    public function setMtimeIndex(int $index, int $timestamp, int $flags = 0) {}
123
124    /** @return bool */
125    public function setMtimeName(string $name, int $timestamp, int $flags = 0) {}
126#endif
127
128    /** @return string|false */
129    public function getCommentIndex(int $index, int $flags = 0) {}
130
131    /** @return string|false */
132    public function getCommentName(string $name, int $flags = 0) {}
133
134    /** @return bool */
135    public function deleteIndex(int $index) {}
136
137    /** @return bool */
138    public function deleteName(string $name) {}
139
140    /** @return array|false */
141    public function statName(string $name, int $flags = 0) {}
142
143    /** @return array|false */
144    public function statIndex(int $index, int $flags = 0) {}
145
146    /** @return int|false */
147    public function locateName(string $name, int $flags = 0) {}
148
149    /** @return string|false */
150    public function getNameIndex(int $index, int $flags = 0) {}
151
152    /** @return bool */
153    public function unchangeArchive() {}
154
155    /** @return bool */
156    public function unchangeAll() {}
157
158    /** @return bool */
159    public function unchangeIndex(int $index) {}
160
161    /** @return bool */
162    public function unchangeName(string $name) {}
163
164    /** @return bool */
165    public function extractTo(string $pathto, array|string|null $files = null) {}
166
167    /** @return string|false */
168    public function getFromName(string $name, int $len = 0, int $flags = 0) {}
169
170    /** @return string|false */
171    public function getFromIndex(int $index, int $len = 0, int $flags = 0) {}
172
173    /** @return resource|false */
174    public function getStream(string $name) {}
175
176#ifdef ZIP_OPSYS_DEFAULT
177    /** @return bool */
178    public function setExternalAttributesName(string $name, int $opsys, int $attr, int $flags = 0) {}
179
180    /** @return bool */
181    public function setExternalAttributesIndex(int $index, int $opsys, int $attr, int $flags = 0) {}
182
183    /**
184     * @param int $opsys
185     * @param int $attr
186     * @return bool
187     */
188    public function getExternalAttributesName(string $name, &$opsys, &$attr, int $flags = 0) {}
189
190    /**
191     * @param int $opsys
192     * @param int $attr
193     * @return bool
194     */
195    public function getExternalAttributesIndex(int $index, &$opsys, &$attr, int $flags = 0) {}
196#endif
197
198    /** @return bool */
199    public function setCompressionName(string $name, int $method, int $compflags = 0) {}
200
201    /** @return bool */
202    public function setCompressionIndex(int $index, int $method, int $compflags = 0) {}
203
204#ifdef HAVE_ENCRYPTION
205    /** @return bool */
206    public function setEncryptionName(string $name, int $method, ?string $password = null) {}
207
208    /** @return bool */
209    public function setEncryptionIndex(int $index, int $method, ?string $password = null) {}
210#endif
211
212#ifdef HAVE_PROGRESS_CALLBACK
213    /** @return bool */
214    public function registerProgressCallback(float $rate, callable $callback) {}
215#endif
216
217#ifdef HAVE_CANCEL_CALLBACK
218    /** @return bool */
219    public function registerCancelCallback(callable $callback) {}
220#endif
221
222#ifdef HAVE_METHOD_SUPPORTED
223    /** @return bool */
224    public static function isCompressionMethodSupported(int $method, bool $enc = true): bool {}
225
226    /** @return bool */
227    public static function isEncryptionMethodSupported(int $method, bool $enc = true): bool {}
228#endif
229}
230