PEAR2_Exception › package.xml
- PEAR2_Exception-0.2.0/
- php/
- PEAR2/
- php/
- package.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?xml version="1.0" encoding="UTF-8"?>
<package version="2.1" xmlns="http://pear.php.net/dtd/package-2.1" 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.1 http://pear.php.net/dtd/package-2.1.xsd">
<name>PEAR2_Exception</name>
<channel>pear2.php.net</channel>
<summary>PEAR2\Exception is the standard exception class for PEAR2.
</summary>
<description>In addition to supporting the default signature of the built-in
Exception class, PEAR2\Exception also supports passing a
cause of an exception, which can be another exception object
or a PEAR2_MultiErrors object. The error messages of the causes
are used when constructing the error message displayed when
converting PEAR2\Exception to a string.
PEAR2\Exception should always be extended by your own custom exception
class for the package.</description>
<lead>
<name>Gregory Beaver</name>
<user>cellog</user>
<email>cellog@php.net</email>
<active>yes</active>
</lead>
<lead>
<name>Tomas V.V. Cox</name>
<user>cox</user>
<email>cox@idecnet.com</email>
<active>no</active>
</lead>
<lead>
<name>Bertrand Mansion</name>
<user>mansion</user>
<email>bmansion@mamasam.com</email>
<active>no</active>
</lead>
<developer>
<name>Hans Lellelid</name>
<user>hlellelid</user>
<email>hans@velum.net</email>
<active>no</active>
</developer>
<date>2010-05-23</date>
<time>08:39:48</time>
<version>
<release>0.2.0</release>
<api>0.1.0</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
<notes>- Covert namespace to PEAR2
- Removed getCause() as it just uses the built in getPrevious() that was added in PHP 5.3
- Removed getUniqueId as it's used anywhere
- Removed toHtml, toText and __toString (which only handled calling the former two).
People should implement their owny decorator calls.
- Removed the built in outputs of the observer functions. Those where the class constants
OBSERVER_PRINT, OBSERVER_TRIGGER, OBSERVER_DIE
This can be achieved by writing a custom callback function, using the appropriate printf(),
trigger_error and die() to achieve the same result.
- Removed getErroClass and getErrorMethod as it can be easily gotten from getTrace/getTraceSafe first array element
- Add the proper LICENSE file and move Exception.php to the NEW BSD license as the package.xml already defines
- Removed __toString, toText and toHtml. For those wanting to get pretty outputs they can use this approach:
$causes = array();
$this->getCauseMessage($causes);
foreach ($causes as $i => $cause) {
var_dump($cause);
}
And combine that with getTraceSafe() or getTraceAsString() if needed.
Put all that in a function and use set_exception_handler('exceptionHandler'); or similar to process
all Exceptions.
Example code or see the removed code at http://svn.php.net/viewvc/pear2/Exception/trunk/src/Exception.php?r1=295348&r2=295352 :
function exceptionHandler($e)
{
if ($e instanceof \PEAR2\Exception) {
$causes = array();
$e->getCauseMessage($causes);
$causeMsg = '';
foreach ($causes as $i => $cause) {
$causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': '
. $cause['message'] . "\n";
}
echo $causeMsg;
} else {
echo $e->getMessage(), "\n";
}
}
set_exception_handler('exceptionHandler');</notes>
<contents>
<dir name="/">
<file role="php" name="php/PEAR2/Exception.php"/>
</dir>
</contents>
<dependencies>
<required>
<php>
<min>5.2.0</min>
</php>
<pearinstaller>
<min>1.4.8</min>
</pearinstaller>
</required>
</dependencies>
<phprelease>
<filelist>
<install name="php/PEAR2/Exception.php" as="PEAR2/Exception.php"/>
</filelist>
</phprelease>
</package>
EOF
