@@ -236,7 +236,8 @@ fn find_global_class_entry_ptr(name: impl AsRef<str>) -> *mut zend_class_entry {
236
236
}
237
237
238
238
/// The [StateClass] holds [zend_class_entry] and inner state, created by
239
- /// [Module::add_class](crate::modules::Module::add_class).
239
+ /// [Module::add_class](crate::modules::Module::add_class) or
240
+ /// [ClassEntity::bind_class].
240
241
///
241
242
/// When the class registered (module initialized), the [StateClass] will
242
243
/// be initialized, so you can use the [StateClass] to new stateful
@@ -690,8 +691,25 @@ impl<T: 'static> ClassEntity<T> {
690
691
. collect ( )
691
692
}
692
693
694
+ /// Get the bound class.
695
+ ///
696
+ /// # Examples
697
+ ///
698
+ /// ```
699
+ /// use phper::classes::{ClassEntity, Visibility};
700
+ ///
701
+ /// pub fn make_foo_class() -> ClassEntity<()> {
702
+ /// let mut class = ClassEntity::<()>::new_with_default_state_constructor("Foo");
703
+ /// let foo_class = class.bind_class();
704
+ /// class.add_static_method("newInstance", Visibility::Public, move |_| {
705
+ /// let mut object = foo_class.init_object()?;
706
+ /// Ok::<_, phper::Error>(object)
707
+ /// });
708
+ /// class
709
+ /// }
710
+ /// ```
693
711
#[ inline]
694
- pub ( crate ) fn bind_class ( & self ) -> StateClass < T > {
712
+ pub fn bind_class ( & self ) -> StateClass < T > {
695
713
self . bind_class . clone ( )
696
714
}
697
715
}
@@ -798,8 +816,9 @@ impl InterfaceEntity {
798
816
Box :: into_raw ( methods. into_boxed_slice ( ) ) . cast ( )
799
817
}
800
818
819
+ /// Get the bound interface.
801
820
#[ inline]
802
- pub ( crate ) fn bind_interface ( & self ) -> Interface {
821
+ pub fn bind_interface ( & self ) -> Interface {
803
822
self . bind_interface . clone ( )
804
823
}
805
824
}
0 commit comments