Permalink
Browse files

update the example code to be a bit more current.

  • Loading branch information...
1 parent 3c226ad commit b11c57734dbe7ee2769e52e24e8adac70e489e6d @helgi helgi committed Feb 22, 2010
Showing with 19 additions and 15 deletions.
  1. +19 −15 src/Exception.php
View
@@ -33,27 +33,31 @@
* 2) Usage example
*
* <code>
- * class PEAR2_MyPackage_Exception extends PEAR2_Exception {}
- * class Test {
+ * namespace pear2;
+ * class PEAR2_MyPackage_Exception extends Exception {}
+ *
+ * class Test
+ * {
* function foo()
* {
- * throw new PEAR2_MyPackage_Exception('Error Message', ERROR_CODE);
+ * throw new PEAR2_MyPackage_Exception('Error Message', 4);
* }
- * }
+ * }
+ *
+ * function myLogger($exception)
+ * {
+ * echo 'Logger: ' . $exception->getMessage() . "\n";
+ * }
*
- * function myLogger($pear2_exception)
- * {
- * echo $pear2_exception->getMessage();
- * }
- * // each time a exception is thrown the 'myLogger' will be called
- * // (its use is completely optional)
- * PEAR2_Exception::addObserver('myLogger');
- * $test = new Test;
- * try {
+ * // each time a exception is thrown the 'myLogger' will be called
+ * // (its use is completely optional)
+ * Exception::addObserver('\pear2\myLogger');
+ * $test = new Test;
+ * try {
* $test->foo();
- * } catch (PEAR2_Exception $e) {
+ * } catch (\Exception $e) {
* print $e;
- * }
+ * }
* </code>
*
* @category pear

0 comments on commit b11c577

Please sign in to comment.