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

/**
 * @class XMLRPCErrorResponse
 */
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>";
	}
}