]> granicus.if.org Git - php/commitdiff
- Add methods to check parameter count
authorMarcus Boerger <helly@php.net>
Mon, 2 Aug 2004 23:10:29 +0000 (23:10 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 2 Aug 2004 23:10:29 +0000 (23:10 +0000)
Zend/zend_reflection_api.c
ext/reflection/php_reflection.c

index 219da845c709524d09e716e9617195592fc316e2..fe8706ebcbda359b7ae8c663e9cd5b7ba7977cee 100644 (file)
@@ -1366,6 +1366,34 @@ ZEND_METHOD(reflection_function, returnsReference)
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionFunction::getNumberOfParameters()
+   Gets the number of required parameters */
+ZEND_METHOD(reflection_function, getNumberOfParameters)
+{
+       reflection_object *intern;
+       zend_function *fptr;
+
+       METHOD_NOTSTATIC;
+       GET_REFLECTION_OBJECT_PTR(fptr);
+
+       RETURN_LONG(fptr->common.num_args);
+}
+/* }}} */
+
+/* {{{ proto public bool ReflectionFunction::getNumberOfRequiredParameters()
+   Gets the number of required parameters */
+ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
+{
+       reflection_object *intern;
+       zend_function *fptr;
+
+       METHOD_NOTSTATIC;
+       GET_REFLECTION_OBJECT_PTR(fptr);
+
+       RETURN_LONG(fptr->common.required_num_args);
+}
+/* }}} */
+
 /* {{{ proto public ReflectionParameter[] Reflection_Function::getParameters()
    Returns an array of parameter objects for this function */
 ZEND_METHOD(reflection_function, getParameters)
@@ -3264,6 +3292,8 @@ static zend_function_entry reflection_function_functions[] = {
        ZEND_ME(reflection_function, invoke, NULL, 0)
        ZEND_ME(reflection_function, returnsReference, NULL, 0)
        ZEND_ME(reflection_function, getParameters, NULL, 0)
+       ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0)
+       ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0)
        {NULL, NULL, NULL}
 };
 
index 219da845c709524d09e716e9617195592fc316e2..fe8706ebcbda359b7ae8c663e9cd5b7ba7977cee 100644 (file)
@@ -1366,6 +1366,34 @@ ZEND_METHOD(reflection_function, returnsReference)
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionFunction::getNumberOfParameters()
+   Gets the number of required parameters */
+ZEND_METHOD(reflection_function, getNumberOfParameters)
+{
+       reflection_object *intern;
+       zend_function *fptr;
+
+       METHOD_NOTSTATIC;
+       GET_REFLECTION_OBJECT_PTR(fptr);
+
+       RETURN_LONG(fptr->common.num_args);
+}
+/* }}} */
+
+/* {{{ proto public bool ReflectionFunction::getNumberOfRequiredParameters()
+   Gets the number of required parameters */
+ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
+{
+       reflection_object *intern;
+       zend_function *fptr;
+
+       METHOD_NOTSTATIC;
+       GET_REFLECTION_OBJECT_PTR(fptr);
+
+       RETURN_LONG(fptr->common.required_num_args);
+}
+/* }}} */
+
 /* {{{ proto public ReflectionParameter[] Reflection_Function::getParameters()
    Returns an array of parameter objects for this function */
 ZEND_METHOD(reflection_function, getParameters)
@@ -3264,6 +3292,8 @@ static zend_function_entry reflection_function_functions[] = {
        ZEND_ME(reflection_function, invoke, NULL, 0)
        ZEND_ME(reflection_function, returnsReference, NULL, 0)
        ZEND_ME(reflection_function, getParameters, NULL, 0)
+       ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0)
+       ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0)
        {NULL, NULL, NULL}
 };