1: <?php
2:
3: /**
4: * XMLRPC Error Response
5: *
6: * @package Elgg.Core
7: * @subpackage XMLRPC
8: */
9: class XMLRPCErrorResponse extends XMLRPCResponse {
10: /**
11: * Set the error response and error code.
12: *
13: * @param string $message The message
14: * @param int $code Error code (default = system error as defined by
15: * http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php)
16: */
17: function __construct($message, $code = -32400) {
18: $this->addParameter(
19: new XMLRPCStructParameter(
20: array (
21: 'faultCode' => new XMLRPCIntParameter($code),
22: 'faultString' => new XMLRPCStringParameter($message)
23: )
24: )
25: );
26: }
27:
28: /**
29: * Output to XML.
30: *
31: * @return string
32: */
33: public function __toString() {
34: return "<methodResponse><fault><value>{$this->parameters[0]}</value></fault></methodResponse>";
35: }
36: }
37: