use PhpXmlRpc\Helper\XMLParser;
use PhpXmlRpc\Helper\Charset;
+/**
+ * Allows effortless implementation of XML-RPC servers
+ */
class Server
{
/**
$pt = $p->kindOf();
}
} else {
- $pt = $in[$n] == 'i4' ? 'int' : strtolower($in[$n]); // dispatch maps never use i4...
+ $pt = ($in[$n] == 'i4') ? 'int' : strtolower($in[$n]); // dispatch maps never use i4...
}
// param index is $n+1, as first member of sig is return type
} else {
// functions using EPI api should NOT return resp objects,
// so make sure we encode the return type correctly
- $r = new Response(php_xmlrpc_encode($r, array('extension_api')));
+ $encoder = new Encoder();
+ $r = new Response($encoder->encode($r, array('extension_api')));
}
} else {
$r = call_user_func_array($func, $params);
if (!is_a($r, '\PhpXmlRpc\Response')) {
// what should we assume here about automatic encoding of datetimes
// and php classes instances???
- $r = new Response(php_xmlrpc_encode($r, $this->phpvals_encoding_options));
+ $encoder = new Encoder();
+ $r = new Response($encoder->encode($r, $this->phpvals_encoding_options));
}
}
} catch (\Exception $e) {
}
/**
- * add a string to the 'internal debug message' (separate from 'user debug message').
+ * Add a string to the 'internal debug message' (separate from 'user debug message').
*
* @param string $string
*/
return $outAr;
}
+ /**
+ * @param Server $server
+ * @param Request $req
+ * @return Response
+ */
public static function _xmlrpcs_getCapabilities($server, $req = null)
{
$encoder = new Encoder();
return new Response($encoder->encode($server->getCapabilities()));
}
+ /**
+ * @param Server $server
+ * @param Request $req
+ * @return Response
+ */
public static function _xmlrpcs_listMethods($server, $req = null) // if called in plain php values mode, second param is missing
{
$outAr = array();
return new Response(new Value($outAr, 'array'));
}
+ /**
+ * @param Server $server
+ * @param Request $req
+ * @return Response
+ */
public static function _xmlrpcs_methodSignature($server, $req)
{
// let accept as parameter both an xmlrpc value or string
return $r;
}
+ /**
+ * @param Server $server
+ * @param Request $req
+ * @return Response
+ */
public static function _xmlrpcs_methodHelp($server, $req)
{
// let accept as parameter both an xmlrpc value or string
return new Value($struct, 'struct');
}
+ /**
+ * @param Server $server
+ * @param Value $call
+ * @return Value
+ */
public static function _xmlrpcs_multicall_do_call($server, $call)
{
if ($call->kindOf() != 'struct') {
return new Value(array($result->value()), 'array');
}
+ /**
+ * @param Server $server
+ * @param Value $call
+ * @return Value
+ */
public static function _xmlrpcs_multicall_do_call_phpvals($server, $call)
{
if (!is_array($call)) {
return new Value(array($result->value()), 'array');
}
+ /**
+ * @param Server $server
+ * @param Request $req
+ * @return Response
+ */
public static function _xmlrpcs_multicall($server, $req)
{
$result = array();