cvs: ZendEngine2 / zend_reflection_api.c

From: Date: Sat, 25 Dec 2004 16:27:27 +0000
Subject: cvs: ZendEngine2 / zend_reflection_api.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3244@lists.php.net to get a copy of this message
helly Sat Dec 25 11:27:27 2004 EDT Modified files: /ZendEngine2 zend_reflection_api.c Log: - Add ReflectionClass::hasMethod() (thanks to Johannes S.) http://cvs.php.net/diff.php/ZendEngine2/zend_reflection_api.c?r1=1.140&r2=1.141&ty=u Index: ZendEngine2/zend_reflection_api.c diff -u ZendEngine2/zend_reflection_api.c:1.140 ZendEngine2/zend_reflection_api.c:1.141 --- ZendEngine2/zend_reflection_api.c:1.140 Wed Nov 24 14:56:54 2004 +++ ZendEngine2/zend_reflection_api.c Sat Dec 25 11:27:27 2004 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_reflection_api.c,v 1.140 2004/11/24 19:56:54 helly Exp $ */ +/* $Id: zend_reflection_api.c,v 1.141 2004/12/25 16:27:27 helly Exp $ */ #include "zend.h" #include "zend_API.h" #include "zend_exceptions.h" @@ -2484,6 +2484,32 @@ } /* }}} */ +/* {{{ proto public bool ReflectionClass::hasMethod(string name) + Returns wether a method exists or not */ +ZEND_METHOD(reflection_class, hasMethod) +{ + reflection_object *intern; + zend_class_entry *ce; + char *name, *lc_name; + int name_len; + + METHOD_NOTSTATIC; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + return; + } + + GET_REFLECTION_OBJECT_PTR(ce); + lc_name = zend_str_tolower_dup(name, name_len); + if (zend_hash_exists(&ce->function_table, lc_name, name_len + 1)) { + efree(lc_name); + RETURN_TRUE; + } else { + efree(lc_name); + RETURN_FALSE; + } +} +/* }}} */ + /* {{{ proto public ReflectionMethod ReflectionClass::getMethod(string name) throws ReflectionException Returns the class' method specified by it's name */ ZEND_METHOD(reflection_class, getMethod) @@ -3625,6 +3651,7 @@ ZEND_ME(reflection_class, getEndLine, NULL, 0) ZEND_ME(reflection_class, getDocComment, NULL, 0) ZEND_ME(reflection_class, getConstructor, NULL, 0) + ZEND_ME(reflection_class, hasMethod, NULL, 0) ZEND_ME(reflection_class, getMethod, NULL, 0) ZEND_ME(reflection_class, getMethods, NULL, 0) ZEND_ME(reflection_class, getProperty, NULL, 0)

« previous php.zend-engine.cvs (#3244) next »