]> granicus.if.org Git - php/commitdiff
Add ReflectionExtension::isTemporary() and ReflectionExtension::isPersistent().
authorJohannes Schlüter <johannes@php.net>
Tue, 30 Mar 2010 20:50:42 +0000 (20:50 +0000)
committerJohannes Schlüter <johannes@php.net>
Tue, 30 Mar 2010 20:50:42 +0000 (20:50 +0000)
NEWS
ext/reflection/php_reflection.c
ext/reflection/tests/ReflectionExtension_isPersistant.phpt [new file with mode: 0644]
ext/reflection/tests/ReflectionExtension_isTemporary.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 304ce05529f73ff061e2bc6b407da8866540fb39..784177b8dbd059b9b567b7eddf93ff0cb30e670d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ PHP                                                                        NEWS
 - Added Tokyo Cabinet abstract DB support to ext/dba. (Michael Maclean)
 - Added Jenkins's one-at-a-time hash support to ext/hash. (Martin Jansen)
 - Added FNV-1 hash support to ext/hash. (Michael Maclean)
+- Added ReflectionExtension::isTemporary() and
+  ReflectionExtension::isPersistent(). (Johannes)
+
 - default_charset if not specified is now UTF-8 instead of ISO-8859-1. (Rasmus)
        
 ?? ??? 20??, PHP 5.3.3
index d1f90e34550fcbb1b31a7e6540aee7ebfe24b3c8..66015707aa484873c32aee77d4e5697191ffb6cd 100644 (file)
@@ -5014,6 +5014,38 @@ ZEND_METHOD(reflection_extension, info)
 }
 /* }}} */
 
+/* {{{ proto public void ReflectionExtension::isPersistent()
+       Returns whether this extension is persistent */
+ZEND_METHOD(reflection_extension, isPersistent)
+{
+       reflection_object *intern;
+    zend_module_entry *module;
+
+    if (zend_parse_parameters_none() == FAILURE) {
+               return;
+       }
+       GET_REFLECTION_OBJECT_PTR(module);
+
+       RETURN_BOOL(module->type == MODULE_PERSISTENT);
+}
+/* }}} */
+
+/* {{{ proto public void ReflectionExtension::isTemporary()
+       Returns whether this extension is temporary */
+ZEND_METHOD(reflection_extension, isTemporary)
+{
+       reflection_object *intern;
+       zend_module_entry *module;
+
+       if (zend_parse_parameters_none() == FAILURE) {
+               return;
+       }
+       GET_REFLECTION_OBJECT_PTR(module);
+
+       RETURN_BOOL(module->type == MODULE_TEMPORARY);
+}
+
+
 /* {{{ method tables */
 static const zend_function_entry reflection_exception_functions[] = {
        {NULL, NULL, NULL}
@@ -5376,6 +5408,8 @@ static const zend_function_entry reflection_extension_functions[] = {
        ZEND_ME(reflection_extension, getClassNames, arginfo_reflection__void, 0)
        ZEND_ME(reflection_extension, getDependencies, arginfo_reflection__void, 0)
        ZEND_ME(reflection_extension, info, arginfo_reflection__void, 0)
+       ZEND_ME(reflection_extension, isPersistent, arginfo_reflection__void, 0)
+       ZEND_ME(reflection_extension, isTemporary, arginfo_reflection__void, 0)
        {NULL, NULL, NULL}
 };
 /* }}} */
diff --git a/ext/reflection/tests/ReflectionExtension_isPersistant.phpt b/ext/reflection/tests/ReflectionExtension_isPersistant.phpt
new file mode 100644 (file)
index 0000000..a78a8bb
--- /dev/null
@@ -0,0 +1,11 @@
+--TEST--
+ReflectionExtension::isPersistent()
+--FILE--
+<?php
+$obj = new ReflectionExtension('reflection');
+var_dump($obj->isPersistent());
+?>
+==DONE==
+--EXPECT--
+bool(true)
+==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_isTemporary.phpt b/ext/reflection/tests/ReflectionExtension_isTemporary.phpt
new file mode 100644 (file)
index 0000000..be97641
--- /dev/null
@@ -0,0 +1,11 @@
+--TEST--
+ReflectionExtension::isTemporary()
+--FILE--
+<?php
+$obj = new ReflectionExtension('reflection');
+var_dump($obj->isTemporary());
+?>
+==DONE==
+--EXPECT--
+bool(false)
+==DONE==