Moved Horde_Exception:: to its own package
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 13 Jul 2009 17:07:32 +0000 (11:07 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 13 Jul 2009 19:41:47 +0000 (13:41 -0600)
framework/Core/lib/Horde/Exception.php [deleted file]
framework/Core/package.xml
framework/Exception/lib/Horde/Exception.php [new file with mode: 0644]
framework/Exception/package.xml [new file with mode: 0644]

diff --git a/framework/Core/lib/Horde/Exception.php b/framework/Core/lib/Horde/Exception.php
deleted file mode 100644 (file)
index 375485e..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/**
- * Horde base exception class, which includes the ability to take the
- * output of error_get_last() as $code and mask itself as that error.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Horde
- * @package  Core
- */
-class Horde_Exception extends Exception
-{
-    /**
-     * Exception constructor
-     *
-     * If $code_or_lasterror is passed the return value of
-     * error_get_last() (or a matching format), the exception will be
-     * rewritten to have its file and line parameters match that of
-     * the array, and any message in the array will be appended to
-     * $message.
-     *
-     * @param mixed $message            The exception message, a PEAR_Error
-     *                                  object, or an Exception object.
-     * @param mixed $code_or_lasterror  Either a numeric error code, or
-     *                                  an array from error_get_last().
-     */
-    public function __construct($message = null, $code_or_lasterror = null)
-    {
-        if (is_object($message) &&
-            method_exists($message, 'getMessage')) {
-            if (is_null($code_or_lasterror) &&
-                method_exists($message, 'getCode')) {
-                $code_or_lasterror = $message->getCode();
-            }
-            $message = $message->getMessage();
-        }
-
-        if (is_null($code_or_lasterror)) {
-            $code_or_lasterror = 0;
-        }
-
-        if (is_array($code_or_lasterror)) {
-            if ($message) {
-                $message .= $code_or_lasterror['message'];
-            } else {
-                $message = $code_or_lasterror['message'];
-            }
-
-            $this->file = $code_or_lasterror['file'];
-            $this->line = $code_or_lasterror['line'];
-            $code = $code_or_lasterror['type'];
-        } else {
-            $code = $code_or_lasterror;
-        }
-
-        if (is_string($code)) {
-            $code = null;
-        }
-
-        parent::__construct($message, $code);
-    }
-
-}
index 7f82604..c86cad5 100644 (file)
@@ -37,7 +37,8 @@ Application Framework.
   <api>beta</api>
  </stability>
  <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Renamed Menu:: as Horde_Menu::.
+ <notes>* Moved Horde_Exception to Exception package.
+ * Renamed Menu:: as Horde_Menu::.
  * Renamed Help:: as Horde_Help::.
  * Removed Text::/Horde_Text::.
  * Converted Horde to Horde 4 coding conventions.
@@ -48,7 +49,6 @@ Application Framework.
     <dir name="Horde">
      <file name="Config.php" role="php" />
      <file name="ErrorHandler.php" role="php" />
-     <file name="Exception.php" role="php" />
      <file name="Help.php" role="php" />
      <file name="Menu.php" role="php" />
      <file name="Registry.php" role="php" />
@@ -91,6 +91,10 @@ Application Framework.
     <channel>pear.horde.org</channel>
    </package>
    <package>
+    <name>Exception</name>
+    <channel>pear.horde.org</channel>
+   </package>
+   <package>
     <name>Prefs</name>
     <channel>pear.horde.org</channel>
    </package>
@@ -114,7 +118,6 @@ Application Framework.
   <filelist>
    <install name="lib/Horde/Config.php" as="Horde/Config.php" />
    <install name="lib/Horde/ErrorHandler.php" as="Horde/ErrorHandler.php" />
-   <install name="lib/Horde/Exception.php" as="Horde/Exception.php" />
    <install name="lib/Horde/Help.php" as="Horde/Help.php" />
    <install name="lib/Horde/Menu.php" as="Horde/Menu.php" />
    <install name="lib/Horde/Registry.php" as="Horde/Registry.php" />
diff --git a/framework/Exception/lib/Horde/Exception.php b/framework/Exception/lib/Horde/Exception.php
new file mode 100644 (file)
index 0000000..070f5f9
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/**
+ * Horde base exception class, which includes the ability to take the
+ * output of error_get_last() as $code and mask itself as that error.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package  Horde_Exception
+ */
+class Horde_Exception extends Exception
+{
+    /**
+     * Exception constructor
+     *
+     * If $code_or_lasterror is passed the return value of
+     * error_get_last() (or a matching format), the exception will be
+     * rewritten to have its file and line parameters match that of
+     * the array, and any message in the array will be appended to
+     * $message.
+     *
+     * @param mixed $message            The exception message, a PEAR_Error
+     *                                  object, or an Exception object.
+     * @param mixed $code_or_lasterror  Either a numeric error code, or
+     *                                  an array from error_get_last().
+     */
+    public function __construct($message = null, $code_or_lasterror = null)
+    {
+        if (is_object($message) &&
+            method_exists($message, 'getMessage')) {
+            if (is_null($code_or_lasterror) &&
+                method_exists($message, 'getCode')) {
+                $code_or_lasterror = $message->getCode();
+            }
+            $message = $message->getMessage();
+        }
+
+        if (is_null($code_or_lasterror)) {
+            $code_or_lasterror = 0;
+        }
+
+        if (is_array($code_or_lasterror)) {
+            if ($message) {
+                $message .= $code_or_lasterror['message'];
+            } else {
+                $message = $code_or_lasterror['message'];
+            }
+
+            $this->file = $code_or_lasterror['file'];
+            $this->line = $code_or_lasterror['line'];
+            $code = $code_or_lasterror['type'];
+        } else {
+            $code = $code_or_lasterror;
+        }
+
+        if (is_string($code)) {
+            $code = null;
+        }
+
+        parent::__construct($message, $code);
+    }
+
+}
diff --git a/framework/Exception/package.xml b/framework/Exception/package.xml
new file mode 100644 (file)
index 0000000..00e5ae2
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.4.9" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>Exception</name>
+ <channel>pear.horde.org</channel>
+ <summary>Horde Exception Handler</summary>
+ <description>This class provides the default exception handler for the Horde Application Framework.
+ </description>
+ <lead>
+  <name>Chuck Hagenbuch</name>
+  <user>chuck</user>
+  <email>chuck@horde.org</email>
+  <active>yes</active>
+ </lead>
+ <lead>
+  <name>Jan Schneider</name>
+  <user>jan</user>
+  <email>jan@horde.org</email>
+  <active>yes</active>
+ </lead>
+ <developer>
+  <name>Michael Slusarz</name>
+  <user>slusarz</user>
+  <email>slusarz@horde.org</email>
+  <active>yes</active>
+ </developer>
+ <date>2009-07-12</date>
+ <version>
+  <release>0.1.0</release>
+  <api>0.1.0</api>
+ </version>
+ <stability>
+  <release>beta</release>
+  <api>beta</api>
+ </stability>
+ <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
+ <notes>* Initial package.
+ </notes>
+ <contents>
+  <dir name="/">
+   <dir name="lib">
+    <dir name="Horde">
+     <file name="Exception.php" role="php" />
+    </dir> <!-- /lib/Horde -->
+   </dir> <!-- /lib -->
+  </dir> <!-- / -->
+ </contents>
+ <dependencies>
+  <required>
+   <php>
+    <min>5.2.0</min>
+   </php>
+   <pearinstaller>
+    <min>1.5.4</min>
+   </pearinstaller>
+  </required>
+ </dependencies>
+ <phprelease>
+  <filelist>
+   <install name="lib/Horde/Exception.php" as="Horde/Exception.php" />
+  </filelist>
+ </phprelease>
+ <changelog/>
+</package>