From 1f93575c88fff9e05e1904ba02d0975ab33f0c67 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Wed, 7 Jun 2006 09:26:11 +0000 Subject: [PATCH] - MFH Add ReflectionClass::getInterfaceNames() --- ext/reflection/php_reflection.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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) -- 2.40.0