diff options
Diffstat (limited to 'crates/shirabe-php-shim/src')
| -rw-r--r-- | crates/shirabe-php-shim/src/lib.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index e6fbf05..6b2d790 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -55,6 +55,31 @@ impl PhpMixed { } } + pub fn as_array_mut(&mut self) -> Option<&mut IndexMap<String, Box<PhpMixed>>> { + match self { + PhpMixed::Array(a) => Some(a), + _ => None, + } + } + + pub fn as_list_mut(&mut self) -> Option<&mut Vec<Box<PhpMixed>>> { + match self { + PhpMixed::List(l) => Some(l), + _ => None, + } + } + + pub fn as_object(&self) -> Option<&ArrayObject> { + match self { + PhpMixed::Object(o) => Some(o), + _ => None, + } + } + + pub fn as_str(&self) -> Option<&str> { + self.as_string() + } + pub fn is_null(&self) -> bool { matches!(self, PhpMixed::Null) } |
