cvs: pear-core /PEAR Exception.php
| From: | Greg Beaver | Date: | Fri, 03 Sep 2004 23:16:41 +0000 |
| Subject: | cvs: pear-core /PEAR Exception.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-23610@lists.php.net to get a copy of this message | ||
cellog Fri Sep 3 19:16:41 2004 EDT
Modified files:
/pear-core/PEAR Exception.php
Log:
make signal private again - there's no way to safely extend it except through callback
observers
add getUniqueId() method to ensure that it is possible to add an observer with a guaranteed unique
identifier.
http://cvs.php.net/diff.php/pear-core/PEAR/Exception.php?r1=1.13&r2=1.14&ty=u
Index: pear-core/PEAR/Exception.php
diff -u pear-core/PEAR/Exception.php:1.13 pear-core/PEAR/Exception.php:1.14
--- pear-core/PEAR/Exception.php:1.13 Thu Sep 2 00:00:19 2004
+++ pear-core/PEAR/Exception.php Fri Sep 3 19:16:40 2004
@@ -19,11 +19,11 @@
// | Greg Beaver <cellog@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Exception.php,v 1.13 2004/09/02 04:00:19 cellog Exp $
+// $Id: Exception.php,v 1.14 2004/09/03 23:16:40 cellog Exp $
-define('PEAR_OBSERVER_PRINT', -2);
-define('PEAR_OBSERVER_TRIGGER', -4);
-define('PEAR_OBSERVER_DIE', -8);
+define('PEAR_EXCEPTION_PRINT', -2);
+define('PEAR_EXCEPTION_TRIGGER', -4);
+define('PEAR_EXCEPTION_DIE', -8);
/**
* Base PEAR_Exception Class
@@ -89,7 +89,7 @@
*
* @since PHP 5
* @package PEAR
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
* @author Tomas V.V.Cox <cox@idecnet.com>
* @author Hans Lellelid <hans@velum.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
@@ -99,6 +99,7 @@
{
protected $cause;
private static $_observers = array();
+ private static $_uniqueid = 0;
private $_trace;
/**
@@ -145,9 +146,14 @@
}
/**
- * Additional signal handling can be added or overridden by child classes
+ * @return int unique identifier for an observer
*/
- protected function signal()
+ public static function getUniqueId()
+ {
+ return self::$_uniqueid++;
+ }
+
+ private function signal()
{
foreach (self::$_observers as $func) {
if (is_callable($func)) {