Skip to content

Commit 29afca2

Browse files
committed
adding methods on function and execute data
1 parent 2e01785 commit 29afca2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

phper/src/functions.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,11 @@ impl ZFunc {
629629
}
630630
}
631631

632+
/// Detects if the function is static.
633+
pub fn is_static(&self) -> bool {
634+
unsafe { (self.inner.op_array.fn_flags & ZEND_ACC_STATIC) != 0 }
635+
}
636+
632637
/// Get the type of the function (sys::ZEND_USER_FUNCTION,
633638
/// sys::ZEND_INTERNAL_FUNCTION, or sys::ZEND_EVAL_CODE).
634639
pub fn get_type(&self) -> u32 {

phper/src/values.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ impl ExecuteData {
191191
}
192192
}
193193

194+
/// Gets associated called scope if it exists
195+
pub fn get_called_scope(&mut self) -> Option<&ZStr> {
196+
unsafe {
197+
let val = ZVal::from_ptr(phper_get_called_scope(&mut self.inner));
198+
val.as_z_str()
199+
}
200+
}
201+
194202
pub(crate) unsafe fn get_parameters_array(&mut self) -> Vec<ManuallyDrop<ZVal>> {
195203
unsafe {
196204
let num_args = self.num_args();

0 commit comments

Comments
 (0)