summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2006-06-07 09:26:11 +0000
committerMarcus Boerger <helly@php.net>2006-06-07 09:26:11 +0000
commit1f93575c88fff9e05e1904ba02d0975ab33f0c67 (patch)
tree23c64eaa133c16555b4403d6720bb88acfa66f5d /ext/reflection/php_reflection.c
parentde39078f7bce68aa5f9bb0fa762cd0eb84324548 (diff)
downloadphp-git-1f93575c88fff9e05e1904ba02d0975ab33f0c67.tar.gz
- MFH Add ReflectionClass::getInterfaceNames()
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 14586f0090..6a2eff02c5 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -3416,6 +3416,26 @@ ZEND_METHOD(reflection_class, getInterfaces)
}
/* }}} */
+/* {{{ proto public String[] ReflectionClass::getInterfaceNames()
+ Returns an array of names of interfaces this class implements */
+ZEND_METHOD(reflection_class, getInterfaceNames)
+{
+ reflection_object *intern;
+ zend_class_entry *ce;
+ zend_uint i;
+
+ METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
+ GET_REFLECTION_OBJECT_PTR(ce);
+
+ /* Return an empty array if this class implements no interfaces */
+ array_init(return_value);
+
+ for (i=0; i < ce->num_interfaces; i++) {
+ add_next_index_stringl(return_value, ce->interfaces[i]->name, ce->interfaces[i]->name_length, 1);
+ }
+}
+/* }}} */
+
/* {{{ proto public ReflectionClass ReflectionClass::getParentClass()
Returns the class' parent class, or, if none exists, FALSE */
ZEND_METHOD(reflection_class, getParentClass)
@@ -4290,6 +4310,7 @@ static zend_function_entry reflection_class_functions[] = {
ZEND_ME(reflection_class, getConstants, NULL, 0)
ZEND_ME(reflection_class, getConstant, NULL, 0)
ZEND_ME(reflection_class, getInterfaces, NULL, 0)
+ ZEND_ME(reflection_class, getInterfaceNames, NULL, 0)
ZEND_ME(reflection_class, isInterface, NULL, 0)
ZEND_ME(reflection_class, isAbstract, NULL, 0)
ZEND_ME(reflection_class, isFinal, NULL, 0)