ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Exception.php
Go to the documentation of this file.
1<?php
2
3/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
4
5// LICENSE AGREEMENT. If folded, press za here to unfold and read license {{{
6
40// }}}
41
52class XML_RPC2_Exception extends Exception
53{
54}
55
56/* Encoding and decoding values exceptions {{{
67class XML_RPC2_InvalidTypeException extends XML_RPC2_Exception
68{
69}
70
81class XML_RPC2_InvalidDateFormatException extends XML_RPC2_Exception
82{
83}
84
95class XML_RPC2_EncodeException extends XML_RPC2_Exception
96{
97}
98
109class XML_RPC2_DecodeException extends XML_RPC2_Exception
110{
111}
112
124class XML_RPC2_InvalidTypeEncodeException extends XML_RPC2_Exception
125{
126}
127/* }}} */
128
140{
141}
142
154{
155}
156
168{
169}
170
182{
183}
184
196{
197
198 // {{{ properties
199
205 protected $faultCode = null;
206
207 // }}}
208 // {{{ constructor
209
215 function __construct($messageString, $faultCode)
216 {
217 parent::__construct($messageString);
218 $this->faultCode = $faultCode;
219 }
220
221 // }}}
222 // {{{ getFaultCode()
223
229 public function getFaultCode()
230 {
231 return $this->faultCode;
232 }
233
234 // }}}
235 // {{{ getFaultString()
236
244 public function getFaultString()
245 {
246 return $this->getMessage();
247 }
248
249 // }}}
250 // {{{ createFromDecode()
251
258 public static function createFromDecode($xml) {
259 require_once 'XML/RPC2/Backend/Php/Value.php';
260
261 // This is the only way I know of creating a new Document rooted in the provided simpleXMLFragment (needed for the xpath expressions that does not segfault sometimes
262 $xml = simplexml_load_string($xml->asXML());
263 $struct = XML_RPC2_Backend_Php_Value::createFromDecode($xml->value)->getNativeValue();
264 if (!(is_array($struct) &&
265 array_key_exists('faultString', $struct) &&
266 array_key_exists('faultCode', $struct))) throw new XML_RPC2_DecodeException('Unable to decode XML-RPC fault payload');
267
268 return new XML_RPC2_FaultException( $struct['faultString'], $struct['faultCode'] );
269 }
270
271 // }}}
272
273}
274
286{
287}
288
300{
301}
302
314{
315}
316
328{
329}
330
331?>
static createFromDecode($simpleXML)
Decode an encoded value and build the applicable XML_RPC2_Value subclass.
Definition: Value.php:215
getFaultCode()
FaultCode getter.
Definition: Exception.php:229
__construct($messageString, $faultCode)
Construct a new XML_RPC2_FaultException with a given message string and fault code.
Definition: Exception.php:215
static createFromDecode($xml)
Create a XML_RPC2_FaultException by decoding the corresponding xml string.
Definition: Exception.php:258
getFaultString()
FaultString getter.
Definition: Exception.php:244