cvs: pear-core /PEAR Exception.php
| From: | Greg Beaver | Date: | Fri, 10 Sep 2004 18:26:20 +0000 |
| Subject: | cvs: pear-core /PEAR Exception.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-23794@lists.php.net to get a copy of this message | ||
cellog Fri Sep 10 14:26:20 2004 EDT
Modified files:
/pear-core/PEAR Exception.php
Log:
use class constants instead of defines()
http://cvs.php.net/diff.php/pear-core/PEAR/Exception.php?r1=1.15&r2=1.16&ty=u
Index: pear-core/PEAR/Exception.php
diff -u pear-core/PEAR/Exception.php:1.15 pear-core/PEAR/Exception.php:1.16
--- pear-core/PEAR/Exception.php:1.15 Fri Sep 3 23:43:21 2004
+++ pear-core/PEAR/Exception.php Fri Sep 10 14:26:20 2004
@@ -19,11 +19,8 @@
// | Greg Beaver <cellog@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Exception.php,v 1.15 2004/09/04 03:43:21 cellog Exp $
+// $Id: Exception.php,v 1.16 2004/09/10 18:26:20 cellog Exp $
-define('PEAR_EXCEPTION_PRINT', -2);
-define('PEAR_EXCEPTION_TRIGGER', -4);
-define('PEAR_EXCEPTION_DIE', -8);
/**
* Base PEAR_Exception Class
@@ -89,7 +86,7 @@
*
* @since PHP 5
* @package PEAR
- * @version $Revision: 1.15 $
+ * @version $Revision: 1.16 $
* @author Tomas V.V.Cox <cox@idecnet.com>
* @author Hans Lellelid <hans@velum.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
@@ -97,6 +94,9 @@
*/
class PEAR_Exception extends Exception
{
+ const OBSERVER_PRINT = -2;
+ const OBSERVER_TRIGGER = -4;
+ const OBSERVER_DIE = -8;
protected $cause;
private static $_observers = array();
private static $_uniqueid = 0;
@@ -133,11 +133,11 @@
/**
* @param mixed $callback - A valid php callback, see php func is_callable()
- * - A PEAR_EXCEPTION_* constant
- * - An array(const PEAR_EXCEPTION_*, mixed $options)
- *
- * @param string $label - The name of the observer. Use this if you want
- * to remove it later with removeObserver()
+ * - A PEAR_Exception::OBSERVER_* constant
+ * - An array(const PEAR_Exception::OBSERVER_*,
+ * mixed $options)
+ * @param string $label The name of the observer. Use this if you want
+ * to remove it later with removeObserver()
*/
public static function addObserver($callback, $label = 'default')
{
@@ -166,15 +166,15 @@
}
settype($func, 'array');
switch ($func[0]) {
- case PEAR_EXCEPTION_PRINT :
+ case self::OBSERVER_PRINT :
$f = (isset($func[1])) ? $func[1] : '%s';
printf($f, $this->getMessage());
break;
- case PEAR_EXCEPTION_TRIGGER :
+ case self::OBSERVER_TRIGGER :
$f = (isset($func[1])) ? $func[1] : E_USER_NOTICE;
trigger_error($this->getMessage(), $f);
break;
- case PEAR_EXCEPTION_DIE :
+ case self::OBSERVER_DIE :
$f = (isset($func[1])) ? $func[1] : '%s';
die(printf($f, $this->getMessage()));
break;