aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/XMLRPCErrorResponse.php
blob: c204a355567bf5c22d4b8b9be003e5633c5709a0 (plain)
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
<?php

/**
 * @class XMLRPCErrorResponse
 * @author Curverider Ltd
 */
class XMLRPCErrorResponse extends XMLRPCResponse
{		
	/**
	 * Set the error response and error code.
	 *
	 * @param string $message The message
	 * @param int $code Error code (default = system error as defined by http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php)
	 */
	function __construct($message, $code = -32400)
	{
		$this->addParameter(
			new XMLRPCStructParameter(
				array (
					'faultCode' => new XMLRPCIntParameter($code),
					'faultString' => new XMLRPCStringParameter($message)
				)
			)
		);
	}
	
	/**
	 * Output to XML.
	 */
	public function __toString()
	{
		return "<methodResponse><fault><value>{$this->parameters[0]}</value></fault></methodResponse>";
	}
}