public function loadXml($fault)
{
if (!is_string($fault)) {
- throw new IPF_Exception('Invalid XML provided to fault');
+ throw new IPF_XmlRpc_Exception('Invalid XML provided to fault');
}
try {
$xml = @new SimpleXMLElement($fault);
} catch (Exception $e) {
// Not valid XML
- throw new IPF_Exception('Failed to parse XML fault: ' . $e->getMessage(), 500);
+ throw new IPF_XmlRpc_Exception('Failed to parse XML fault: ' . $e->getMessage(), 500);
}
// Check for fault
if (!$xml->fault->value->struct) {
// not a proper fault
- throw new IPF_Exception('Invalid fault structure', 500);
+ throw new IPF_XmlRpc_Exception('Invalid fault structure', 500);
}
$structXml = $xml->fault->value->asXML();
}
if (empty($code) && empty($message)) {
- throw new IPF_Exception('Fault code and string required');
+ throw new IPF_XmlRpc_Exception('Fault code and string required');
}
if (empty($code)) {
$fault = new self();
try {
$isFault = $fault->loadXml($xml);
- } catch (IPF_Exception $e) {
+ } catch (IPF_XmlRpc_Exception $e) {
$isFault = false;
}
$name = empty($ns) ? $name : $ns . '.' . $name;
if (isset($table[$name])) {
- throw new IPF_Exception('Duplicate method registered: ' . $name);
+ throw new IPF_XmlRpc_Exception('Duplicate method registered: ' . $name);
}
$table[$name] = $dispatchable;
$this->_fixTypes($dispatchable);
$name = empty($ns) ? $name : $ns . '.' . $name;
if (isset($table[$name])) {
- throw new IPF_Exception('Duplicate method registered: ' . $name);
+ throw new IPF_XmlRpc_Exception('Duplicate method registered: ' . $name);
}
$table[$name] = $method;
$this->_fixTypes($method);
public function addFunction($function, $namespace = '')
{
if (!is_string($function) && !is_array($function)) {
- throw new IPF_Exception('Unable to attach function; invalid', 611);
+ throw new IPF_XmlRpc_Exception('Unable to attach function; invalid', 611);
}
$argv = null;
$function = (array) $function;
foreach ($function as $func) {
if (!is_string($func) || !function_exists($func)) {
- throw new IPF_Exception('Unable to attach function; invalid', 611);
+ throw new IPF_XmlRpc_Exception('Unable to attach function; invalid', 611);
}
$this->_methods[] = IPF_Server_Reflection::reflectFunction($func, $argv, $namespace);
}
public function loadFunctions($array)
{
if (!is_array($array)) {
- throw new IPF_Exception('Unable to load array; not an array', 612);
+ throw new IPF_XmlRpc_Exception('Unable to load array; not an array', 612);
}
foreach ($array as $key => $value) {
if (!$value instanceof IPF_Server_Reflection_Function_Abstract
&& !$value instanceof IPF_Server_Reflection_Class)
{
- throw new IPF_Exception('One or more method records are corrupt or otherwise unusable', 613);
+ throw new IPF_XmlRpc_Exception('One or more method records are corrupt or otherwise unusable', 613);
}
if ($value->system) {
{
if (is_string($class) && !class_exists($class)) {
if (!class_exists($class)) {
- throw new IPF_Exception('Invalid method class', 610);
+ throw new IPF_XmlRpc_Exception('Invalid method class', 610);
}
}
if (is_string($request) && class_exists($request)) {
$request = new $request();
if (!$request instanceof IPF_XmlRpc_Request) {
- throw new IPF_Exception('Invalid request class');
+ throw new IPF_XmlRpc_Exception('Invalid request class');
}
$request->setEncoding($this->getEncoding());
} elseif (!$request instanceof IPF_XmlRpc_Request) {
- throw new IPF_Exception('Invalid request object');
+ throw new IPF_XmlRpc_Exception('Invalid request object');
}
$this->_request = $request;
{
if (!$fault instanceof Exception) {
$fault = (string) $fault;
- $fault = new IPF_Exception($fault, $code);
+ $fault = new IPF_XmlRpc_Exception($fault, $code);
}
return IPF_XmlRpc_Server_Fault::getInstance($fault);
}
// Check for valid method
if (!isset($this->_table[$method])) {
- throw new IPF_Exception('Method "' . $method . '" does not exist', 620);
+ throw new IPF_XmlRpc_Exception('Method "' . $method . '" does not exist', 620);
}
$info = $this->_table[$method];
}
}
if (!$matched) {
- throw new IPF_Exception('Calling parameters do not match signature', 623);
+ throw new IPF_XmlRpc_Exception('Calling parameters do not match signature', 623);
}
if ($info instanceof IPF_Server_Reflection_Function) {
try {
$object = $info->getDeclaringClass()->newInstance();
} catch (Exception $e) {
- throw new IPF_Exception('Error instantiating class ' . $class . ' to invoke method ' . $info->getName(), 621);
+ throw new IPF_XmlRpc_Exception('Error instantiating class ' . $class . ' to invoke method ' . $info->getName(), 621);
}
$return = $info->invokeArgs($object, $params);
}
} else {
- throw new IPF_Exception('Method missing implementation ' . get_class($info), 622);
+ throw new IPF_XmlRpc_Exception('Method missing implementation ' . get_class($info), 622);
}
$response = new ReflectionClass($this->_responseClass);
public function methodHelp($method)
{
if (!isset($this->_table[$method])) {
- throw new IPF_Exception('Method "' . $method . '"does not exist', 640);
+ throw new IPF_XmlRpc_Exception('Method "' . $method . '"does not exist', 640);
}
return $this->_table[$method]->getDescription();
public function methodSignature($method)
{
if (!isset($this->_table[$method])) {
- throw new IPF_Exception('Method "' . $method . '"does not exist', 640);
+ throw new IPF_XmlRpc_Exception('Method "' . $method . '"does not exist', 640);
}
$prototypes = $this->_table[$method]->getPrototypes();
return new IPF_XmlRpc_Value_Struct($value);
default:
- throw new IPF_Exception('Given type is not a '. __CLASS__ .' constant');
+ throw new IPF_XmlRpc_Exception('Given type is not a '. __CLASS__ .' constant');
}
}
$simple_xml = @new SimpleXMLElement($simple_xml);
} catch (Exception $e) {
// The given string is not a valid XML
- throw new IPF_Exception('Failed to create XML-RPC value from XML string: '.$e->getMessage(),$e->getCode());
+ throw new IPF_XmlRpc_Exception('Failed to create XML-RPC value from XML string: '.$e->getMessage(),$e->getCode());
}
}
case self::XMLRPC_TYPE_ARRAY:
// If the XML is valid, $value must be an SimpleXML element and contain the <data> tag
if (!$value instanceof SimpleXMLElement) {
- throw new IPF_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type');
+ throw new IPF_XmlRpc_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type');
}
// PHP 5.2.4 introduced a regression in how empty($xml->value)
}
if (null === $data) {
- throw new IPF_Exception('Invalid XML for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type: ARRAY tag must contain DATA tag');
+ throw new IPF_XmlRpc_Exception('Invalid XML for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type: ARRAY tag must contain DATA tag');
}
$values = array();
// Parse all the elements of the array from the XML string
case self::XMLRPC_TYPE_STRUCT:
// If the XML is valid, $value must be an SimpleXML
if ((!$value instanceof SimpleXMLElement)) {
- throw new IPF_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_STRUCT .' type');
+ throw new IPF_XmlRpc_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_STRUCT .' type');
}
$values = array();
// Parse all the memebers of the struct from the XML string
$xmlrpc_val = new IPF_XmlRpc_Value_Struct($values);
break;
default:
- throw new IPF_Exception('Value type \''. $type .'\' parsed from the XML string is not a known XML-RPC native type');
+ throw new IPF_XmlRpc_Exception('Value type \''. $type .'\' parsed from the XML string is not a known XML-RPC native type');
break;
}
$xmlrpc_val->_setXML($simple_xml->asXML());