use indexmap::IndexMap; #[derive(Debug, Clone)] pub enum PhpMixed { Null, Bool(bool), Int(i64), Float(f64), String(String), List(Vec>), Array(IndexMap>), } impl PhpMixed { pub fn as_bool(&self) -> Option { match self { PhpMixed::Bool(b) => Some(*b), _ => None, } } pub fn as_int(&self) -> Option { match self { PhpMixed::Int(i) => Some(*i), _ => None, } } pub fn as_float(&self) -> Option { 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>> { match self { PhpMixed::List(l) => Some(l), _ => None, } } pub fn as_array(&self) -> Option<&IndexMap>> { 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, } #[derive(Debug)] pub struct LogicException { pub message: String, pub code: i64, } #[derive(Debug)] pub struct ErrorException { pub message: String, pub code: i64, pub severity: i64, pub filename: String, pub lineno: 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 { todo!() } pub fn pack(format: &str, values: &[PhpMixed]) -> Vec { todo!() } pub fn unpack(format: &str, data: &[u8]) -> Option>> { 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 fseek(stream: PhpMixed, offset: i64) -> i64 { todo!() } pub fn rewind(stream: PhpMixed) -> bool { todo!() } pub fn strip_tags(str: &str) -> String { todo!() } pub const PHP_EOL: &str = "\n"; 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 parse_url_all(url: &str) -> 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 microtime(get_as_float: bool) -> f64 { todo!() } pub fn error_reporting(level: Option) -> i64 { todo!() } pub const E_ALL: i64 = 32767; 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 { todo!() } pub fn iter(&self) -> impl Iterator { 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!() } } #[derive(Debug)] pub struct ZipArchive { pub num_files: i64, } impl ZipArchive { pub fn new() -> Self { todo!() } pub fn open(&mut self, filename: &str) -> bool { todo!() } pub fn close(&self) { todo!() } pub fn locate_name(&self, name: &str) -> Option { todo!() } pub fn get_from_index(&self, index: i64) -> Option { todo!() } pub fn get_name_index(&self, index: i64) -> String { todo!() } pub fn get_stream(&self, name: &str) -> Option { todo!() } pub fn add_empty_dir(&self, local_name: &str) -> bool { todo!() } pub fn add_file(&self, filepath: &str, local_name: &str) -> bool { todo!() } pub fn set_external_attributes_name(&self, name: &str, opsys: i64, attr: i64) -> bool { todo!() } pub fn get_status_string(&self) -> String { todo!() } } impl ZipArchive { pub const CREATE: i64 = 1; pub const OPSYS_UNIX: i64 = 3; } pub trait JsonSerializable { fn json_serialize(&self) -> PhpMixed; } pub trait Countable { fn count(&self) -> i64; } pub fn in_array(needle: PhpMixed, haystack: &PhpMixed, strict: bool) -> bool { todo!() } pub fn realpath(path: &str) -> Option { todo!() } pub fn json_encode(value: &PhpMixed) -> Option { todo!() } pub fn preg_quote(str: &str, delimiter: Option) -> String { todo!() } pub fn dirname(path: &str) -> String { todo!() } pub fn stream_get_contents(stream: PhpMixed) -> Option { todo!() } pub fn class_exists(name: &str) -> bool { todo!() } pub fn touch(path: &str) -> bool { todo!() } pub fn chmod(path: &str, mode: u32) -> bool { todo!() } pub fn strpbrk(haystack: &str, char_list: &str) -> Option { todo!() } pub fn rawurldecode(s: &str) -> String { todo!() } pub fn rawurlencode(s: &str) -> String { todo!() } pub fn base64_encode(data: &str) -> String { todo!() } pub fn fileperms(path: &str) -> i64 { todo!() } pub const FILTER_VALIDATE_BOOLEAN: i64 = 258; pub fn filter_var(value: &str, filter: i64) -> bool { todo!() } pub fn ini_get(option: &str) -> Option { todo!() } pub fn set_error_handler(callback: fn(i64, &str, &str, i64) -> bool) { todo!() } pub fn debug_backtrace() -> Vec>> { todo!() } pub const PHP_VERSION: &str = "8.1.0"; pub const STDERR: i64 = 2; pub fn is_resource(value: &PhpMixed) -> 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 { todo!() } pub fn get_entries(&self) -> Option> { todo!() } pub fn close(&self) { todo!() } } pub fn array_fill_keys(keys: PhpMixed, value: PhpMixed) -> PhpMixed { todo!() } pub fn array_merge(array1: PhpMixed, array2: PhpMixed) -> PhpMixed { todo!() }