helly           Wed Jun  7 09:11:58 2006 UTC

  Modified files:              
    /php-src/ext/reflection     php_reflection.c 
  Log:
  - Add ReflectionClass::getInterfaceNames()
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/reflection/php_reflection.c?r1=1.232&r2=1.233&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.232 
php-src/ext/reflection/php_reflection.c:1.233
--- php-src/ext/reflection/php_reflection.c:1.232       Sun Jun  4 10:11:48 2006
+++ php-src/ext/reflection/php_reflection.c     Wed Jun  7 09:11:58 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.232 2006/06/04 10:11:48 helly Exp $ */
+/* $Id: php_reflection.c,v 1.233 2006/06/07 09:11:58 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -3441,6 +3441,26 @@
 }
 /* }}} */
 
+/* {{{ 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_textl(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)
@@ -4176,8 +4196,7 @@
                        /* FIXME: Unicode support??? */
                        add_assoc_zval_ex(class_array, (*pce)->name.s, 
(*pce)->name_length + 1, zclass);
                } else {
-                       /* FIXME: Unicode support??? */
-                       add_next_index_stringl(class_array, (*pce)->name.s, 
(*pce)->name_length, 1);
+                       add_next_index_textl(class_array, (*pce)->name, 
(*pce)->name_length, 1);
                }
        }
        return ZEND_HASH_APPLY_KEEP;
@@ -4352,6 +4371,7 @@
        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)
@@ -4543,7 +4563,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Reflection", "enabled");
 
-       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.232 
2006/06/04 10:11:48 helly Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.233 
2006/06/07 09:11:58 helly Exp $");
 
        php_info_print_table_end();
 } /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to