public function fault($fault = null, $code = 404) { if (!$fault instanceof Exception) { $fault = (string) $fault; if (empty($fault)) { $fault = 'Unknown Error'; } // require_once 'Zend/XmlRpc/Server/Exception.php'; $fault = new Zend_XmlRpc_Server_Exception($fault, $code); } return Zend_XmlRpc_Server_Fault::getInstance($fault); }
/** * __toString() test */ public function test__toString() { $dom = new DOMDocument('1.0', 'UTF-8'); $r = $dom->appendChild($dom->createElement('methodResponse')); $f = $r->appendChild($dom->createElement('fault')); $v = $f->appendChild($dom->createElement('value')); $s = $v->appendChild($dom->createElement('struct')); $m1 = $s->appendChild($dom->createElement('member')); $m1->appendChild($dom->createElement('name', 'faultCode')); $cv = $m1->appendChild($dom->createElement('value')); $cv->appendChild($dom->createElement('int', 411)); $m2 = $s->appendChild($dom->createElement('member')); $m2->appendChild($dom->createElement('name', 'faultString')); $sv = $m2->appendChild($dom->createElement('value')); $sv->appendChild($dom->createElement('string', 'Testing fault')); $xml = $dom->saveXML(); // require_once 'Zend/XmlRpc/Server/Exception.php'; $e = new Zend_XmlRpc_Server_Exception('Testing fault', 411); $fault = Zend_XmlRpc_Server_Fault::getInstance($e); $this->assertEquals(trim($xml), trim($fault->__toString())); }
/** * Raise an xmlrpc server fault * * @param string|Exception $fault * @param int $code * @return Zend_XmlRpc_Server_Fault */ public function fault($fault, $code = 404) { if (!$fault instanceof Exception) { $fault = (string) $fault; $fault = new Zend_XmlRpc_Server_Exception($fault, $code); } return Zend_XmlRpc_Server_Fault::getInstance($fault); }
/** * Raise an xmlrpc server fault * * @param string|Exception $fault * @param int $code * @return Zend_XmlRpc_Server_Fault */ public function fault($fault = null, $code = 404) { if (!$fault instanceof Exception) { $fault = (string) $fault; if (empty($fault)) { $fault = 'Unknown error'; } $fault = new Zend_XmlRpc_Server_Exception($fault, $code); } return Zend_XmlRpc_Server_Fault::getInstance($fault); }