1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
use indexmap::IndexMap;
#[derive(Debug, Clone)]
pub enum PhpMixed {
Null,
Bool(bool),
Int(i64),
Float(f64),
String(String),
List(Vec<Box<PhpMixed>>),
Array(IndexMap<String, Box<PhpMixed>>),
}
impl PhpMixed {
pub fn as_bool(&self) -> Option<bool> {
match self {
PhpMixed::Bool(b) => Some(*b),
_ => None,
}
}
pub fn as_int(&self) -> Option<i64> {
match self {
PhpMixed::Int(i) => Some(*i),
_ => None,
}
}
pub fn as_float(&self) -> Option<f64> {
match self {
PhpMixed::Float(f) => Some(*f),
_ => None,
}
}
pub fn as_string(&self) -> Option<&str> {
match self {
PhpMixed::String(s) => Some(s.as_str()),
_ => None,
}
}
pub fn as_list(&self) -> Option<&Vec<Box<PhpMixed>>> {
match self {
PhpMixed::List(l) => Some(l),
_ => None,
}
}
pub fn as_array(&self) -> Option<&IndexMap<String, Box<PhpMixed>>> {
match self {
PhpMixed::Array(a) => Some(a),
_ => None,
}
}
pub fn is_null(&self) -> bool {
matches!(self, PhpMixed::Null)
}
}
#[derive(Debug)]
pub struct Exception {
pub message: String,
pub code: i64,
}
#[derive(Debug)]
pub struct RuntimeException {
pub message: String,
pub code: i64,
}
#[derive(Debug)]
pub struct UnexpectedValueException {
pub message: String,
pub code: i64,
}
#[derive(Debug)]
pub struct InvalidArgumentException {
pub message: String,
pub code: i64,
}
pub fn is_bool(value: &PhpMixed) -> bool {
todo!()
}
pub fn is_string(value: &PhpMixed) -> bool {
todo!()
}
pub fn empty(value: &PhpMixed) -> bool {
todo!()
}
pub fn method_exists(object: &PhpMixed, method_name: &str) -> bool {
todo!()
}
pub fn get_class(object: &PhpMixed) -> String {
todo!()
}
pub fn get_debug_type(value: &PhpMixed) -> String {
todo!()
}
pub fn defined(name: &str) -> bool {
todo!()
}
pub fn hash(algo: &str, data: &str) -> String {
todo!()
}
pub fn hash_raw(algo: &str, data: &str) -> Vec<u8> {
todo!()
}
pub fn unpack(format: &str, data: &[u8]) -> Option<IndexMap<String, Box<PhpMixed>>> {
todo!()
}
pub const PHP_VERSION_ID: i64 = 80100;
pub fn extension_loaded(name: &str) -> bool {
todo!()
}
pub fn gzopen(file: &str, mode: &str) -> PhpMixed {
todo!()
}
pub fn gzread(file: PhpMixed, length: i64) -> String {
todo!()
}
pub fn gzclose(file: PhpMixed) {
todo!()
}
pub fn fopen(file: &str, mode: &str) -> PhpMixed {
todo!()
}
pub fn fwrite(file: PhpMixed, data: &str, length: i64) {
todo!()
}
pub fn fclose(file: PhpMixed) {
todo!()
}
pub fn parse_url(url: &str, component: i64) -> PhpMixed {
todo!()
}
pub fn pathinfo(path: PhpMixed, option: i64) -> PhpMixed {
todo!()
}
pub fn strtr(str: &str, from: &str, to: &str) -> String {
todo!()
}
pub fn implode(glue: &str, pieces: &[String]) -> String {
todo!()
}
pub fn version_compare(v1: &str, v2: &str, op: &str) -> bool {
todo!()
}
pub fn error_reporting(level: Option<i64>) -> i64 {
todo!()
}
pub const E_WARNING: i64 = 2;
pub const E_NOTICE: i64 = 8;
pub const E_USER_WARNING: i64 = 512;
pub const E_USER_NOTICE: i64 = 1024;
pub const E_DEPRECATED: i64 = 8192;
pub const E_USER_DEPRECATED: i64 = 16384;
pub const PHP_URL_PATH: i64 = 5;
pub const PATHINFO_FILENAME: i64 = 64;
pub const DIRECTORY_SEPARATOR: &str = "/";
pub const HHVM_VERSION: Option<&str> = None;
#[derive(Debug)]
pub struct Phar {
path: String,
}
impl Phar {
pub fn new(a: String) -> Self {
todo!()
}
pub fn extract_to(&self, a: &str, b: Option<()>, c: bool) {
todo!()
}
}
#[derive(Debug)]
pub struct PharFileInfo;
impl PharFileInfo {
pub fn get_content(&self) -> String {
todo!()
}
pub fn get_basename(&self) -> String {
todo!()
}
pub fn is_dir(&self) -> bool {
todo!()
}
}
#[derive(Debug)]
pub struct PharData {
path: String,
}
impl PharData {
pub fn new(a: String) -> Self {
todo!()
}
pub fn valid(&self) -> bool {
todo!()
}
pub fn get(&self, key: &str) -> Option<PharFileInfo> {
todo!()
}
pub fn iter(&self) -> impl Iterator<Item = PharFileInfo> {
todo!();
std::iter::empty()
}
pub fn extract_to(&self, a: &str, b: Option<()>, c: bool) {
todo!()
}
pub fn add_empty_dir(&self, a: &str) {
todo!()
}
}
pub trait JsonSerializable {
fn json_serialize(&self) -> PhpMixed;
}
pub fn class_exists(name: &str) -> bool {
todo!()
}
#[derive(Debug)]
pub struct RarEntry;
impl RarEntry {
pub fn extract(&self, path: &str) -> bool {
todo!()
}
}
pub fn var_export(_value: &PhpMixed, _return: bool) -> String {
todo!()
}
#[derive(Debug)]
pub struct RarArchive;
impl RarArchive {
pub fn open(file: &str) -> Option<Self> {
todo!()
}
pub fn get_entries(&self) -> Option<Vec<RarEntry>> {
todo!()
}
pub fn close(&self) {
todo!()
}
}
|