cvs: php-src /pear/PEAR ErrorStack.php
| From: | Greg Beaver | Date: | Sun, 21 Mar 2004 23:00:55 +0000 |
| Subject: | cvs: php-src /pear/PEAR ErrorStack.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-201@lists.php.net to get a copy of this message | ||
cellog Sun Mar 21 18:00:55 2004 EDT
Modified files:
/php-src/pear/PEAR ErrorStack.php
Log:
small changes
Use '' instead of ""
allow subclasses to easily change the exception class used just by
overriding the _exceptionClass property
http://cvs.php.net/diff.php/php-src/pear/PEAR/ErrorStack.php?r1=1.1&r2=1.2&ty=u
Index: php-src/pear/PEAR/ErrorStack.php
diff -u php-src/pear/PEAR/ErrorStack.php:1.1 php-src/pear/PEAR/ErrorStack.php:1.2
--- php-src/pear/PEAR/ErrorStack.php:1.1 Thu Mar 18 19:48:18 2004
+++ php-src/pear/PEAR/ErrorStack.php Sun Mar 21 18:00:54 2004
@@ -17,7 +17,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: ErrorStack.php,v 1.1 2004/03/19 00:48:18 cellog Exp $
+// $Id: ErrorStack.php,v 1.2 2004/03/21 23:00:54 cellog Exp $
/**
* Error Stack Implementation
@@ -91,23 +91,23 @@
* If this is returned, then the error will only be pushed onto the stack,
* and not logged.
*/
-define("PEAR_ERRORSTACK_PUSH", 2);
+define('PEAR_ERRORSTACK_PUSH', 2);
/**
* If this is returned, then the error will only be logged, but not pushed
* onto the error stack.
*/
-define("PEAR_ERRORSTACK_LOG", 3);
+define('PEAR_ERRORSTACK_LOG', 3);
/**
* If this is returned, then the error is completely ignored.
*/
-define("PEAR_ERRORSTACK_IGNORE", 4);
+define('PEAR_ERRORSTACK_IGNORE', 4);
/**#@-*/
/**
* Error code for an attempt to instantiate a non-class as a PEAR_ErrorStack in
* the singleton method.
*/
-define("PEAR_ERRORSTACK_ERR_NONCLASS", 1);
+define('PEAR_ERRORSTACK_ERR_NONCLASS', 1);
/**
* Error code for an attempt to pass an object into {@link PEAR_ErrorStack::getMessage()}
@@ -218,13 +218,16 @@
* in PHP 5
*/
function PEAR_ErrorStack($package, $msgCallback = false, $contextCallback = false,
- $throwPEAR_Error = false, $exceptionClass = 'Exception')
+ $throwPEAR_Error = false, $exceptionClass = null)
{
$this->_package = $package;
$this->setMessageCallback($msgCallback);
$this->setContextCallback($contextCallback);
$this->_compat = $throwPEAR_Error;
- $this->_exceptionClass = $exceptionClass;
+ // this allows child classes to simply redefine $this->_exceptionClass
+ if (!is_null($exceptionClass)) {
+ $this->_exceptionClass = $exceptionClass;
+ }
}
/**
@@ -244,7 +247,7 @@
* @return PEAR_ErrorStack
*/
function &singleton($package, $msgCallback = false, $contextCallback = false,
- $throwPEAR_Error = false, $exceptionClass = 'Exception',
+ $throwPEAR_Error = false, $exceptionClass = null,
$stackClass = 'PEAR_ErrorStack')
{
if (isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) {
@@ -306,7 +309,6 @@
*
* This method sets the callback that can be used to generate error
* messages for any instance
- * @param string $package Package Name
* @param array|string Callback function/method
*/
function setMessageCallback($msgCallback)
@@ -353,7 +355,6 @@
*
* This method sets the callback that can be used to generate error
* messages for any PEAR_ErrorStack instance
- * @param string $package Package Name
* @param array|string Callback function/method
*/
function setContextCallback($contextCallback)
@@ -418,6 +419,7 @@
* Remove a callback from every error callback stack
* @see staticPushCallback()
* @return array|string|false
+ * @static
*/
function staticPopCallback()
{