aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-rpc/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-php-rpc/src')
-rw-r--r--crates/shirabe-php-rpc/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/shirabe-php-rpc/src/lib.rs b/crates/shirabe-php-rpc/src/lib.rs
index 05067420..085425c9 100644
--- a/crates/shirabe-php-rpc/src/lib.rs
+++ b/crates/shirabe-php-rpc/src/lib.rs
@@ -44,6 +44,14 @@ pub fn get_constant(name: &str) -> PhpMixed {
call("constant", name)
}
+/// PHP `class_exists($name)`, with autoloading, as the runtime sees it.
+pub fn class_exists(name: &str) -> bool {
+ match call("class_exists", name) {
+ PhpMixed::Bool(exists) => exists,
+ other => panic!("PHP RPC: `class_exists` returned an unexpected value: {other:?}"),
+ }
+}
+
/// PHP `inet_pton($address)`.
pub fn inet_pton(address: &str) -> PhpMixed {
call("inet_pton", address)