Re: Re: PEAR_Exception in CVS

From: Date: Fri, 02 Jul 2004 12:04:37 +0000
Subject: Re: Re: PEAR_Exception in CVS
References: 1 2 3 4 5 6  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31488@lists.php.net to get a copy of this message
Alan Knowles wrote:
or better, just make the translator a special observer.. (although it does more than observe!) - keeps the API kiss.. and thin. PEAR_Exception::addObserver('translator','gettext'); PEAR_Exception::addObserver('translator',array(&$translator,'get'));
Cool, finally someone got a very usefull observer application :-)
- A static method for pushing errors in the internal stack - A static method for getting the array of warnings - Ability to attach observers to warnings too.
PEAR_Exception::addObserver('warning',PEAR_OBSERVER_TRIGGER);
Nice too, a reserved observer label called "warning". Another example why labelled observers are usefull ;)
$foo = new foo; $foo->bar(); $warnings = PEAR_Exception::getWarnings($class = null);
$warning = PEAR_Exception::lastWarning(); or just $warning = PEAR_Exception::last(); maybe only store the last warning/exception?.. - if you want to know more, then adding PEAR_Exception_Stack as an observer to PEAR_Exception would be more effecient - that way we avoid storing a huge array of historical data unnecessarily.
Ala $php_errormsg? Is good by me. I'd add protected getWarning() which could be overritten by Greg's future PEAR_Exception_Stack ;) (stackable msgs, per package/class msgs, etc) Will give that a chance and play arround this ideas. Tomas V.V.Cox

« previous php.pear.dev (#31488) next »