summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-06-02 15:29:42 +0000
committerFelipe Pena <felipe@php.net>2010-06-02 15:29:42 +0000
commitc98c39b1c11221ae8de384942b75a4106d0c7f37 (patch)
treefcecc984b7f25d6f2c28a2d2167715541150194d /ext/reflection/php_reflection.c
parentb03678348c43797f74a8097933a958cc300609ae (diff)
downloadphp-git-c98c39b1c11221ae8de384942b75a4106d0c7f37.tar.gz
- Added ReflectionClass::isCloneable() [DOC]
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index a3aaf3eea1..6bf04df414 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -3987,6 +3987,39 @@ ZEND_METHOD(reflection_class, isInstantiable)
}
/* }}} */
+/* {{{ proto public bool ReflectionClass::isCloneable()
+ Returns whether this class is cloneable */
+ZEND_METHOD(reflection_class, isCloneable)
+{
+ reflection_object *intern;
+ zend_class_entry *ce;
+ zval obj;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+ GET_REFLECTION_OBJECT_PTR(ce);
+ if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) {
+ RETURN_FALSE;
+ }
+ if (intern->obj) {
+ if (ce->clone) {
+ RETURN_BOOL(ce->clone->common.fn_flags & ZEND_ACC_PUBLIC);
+ } else {
+ RETURN_BOOL(Z_OBJ_HANDLER_P(intern->obj, clone_obj) != NULL);
+ }
+ } else {
+ object_init_ex(&obj, ce);
+ if (ce->clone) {
+ RETVAL_BOOL(ce->clone->common.fn_flags & ZEND_ACC_PUBLIC);
+ } else {
+ RETVAL_BOOL(Z_OBJ_HANDLER(obj, clone_obj) != NULL);
+ }
+ zval_dtor(&obj);
+ }
+}
+/* }}} */
+
/* {{{ proto public bool ReflectionClass::isInterface()
Returns whether this is an interface or a class */
ZEND_METHOD(reflection_class, isInterface)
@@ -5693,6 +5726,7 @@ static const zend_function_entry reflection_class_functions[] = {
ZEND_ME(reflection_class, isInternal, arginfo_reflection__void, 0)
ZEND_ME(reflection_class, isUserDefined, arginfo_reflection__void, 0)
ZEND_ME(reflection_class, isInstantiable, arginfo_reflection__void, 0)
+ ZEND_ME(reflection_class, isCloneable, arginfo_reflection__void, 0)
ZEND_ME(reflection_class, getFileName, arginfo_reflection__void, 0)
ZEND_ME(reflection_class, getStartLine, arginfo_reflection__void, 0)
ZEND_ME(reflection_class, getEndLine, arginfo_reflection__void, 0)