$this->proxy_pass,
$this->proxy_authtype,
$method,
- $this->keepalive,
$this->key,
$this->keypass,
$this->sslversion
$method='http')
{
return $this->sendPayloadSocket($req, $server, $port, $timeout, $username, $password, $authType, null, null,
- null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType);
+ null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType, $method);
}
/**
$payload = $req->payload;
// Deflate request body and set appropriate request headers
+ $encodingHdr = '';
if (function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate')) {
if ($this->request_compression == 'gzip') {
$a = @gzencode($payload);
$encodingHdr = "Content-Encoding: deflate\r\n";
}
}
- } else {
- $encodingHdr = '';
}
// thanks to Grant Rauscher <grant7@firstworld.net> for this
break;
case 'struct':
$code = $val['faultCode'];
+ /** @var Value $code */
if ($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') {
return false;
}
$str = $val['faultString'];
+ /** @var Value $str */
if ($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') {
return false;
}
/**
* A helper class to easily convert between Value objects and php native values
+ * @todo implement an interface
*/
class Encoder
{
case 'methodresponse':
$v = &$xmlRpcParser->_xh['value'];
if ($xmlRpcParser->_xh['isf'] == 1) {
+ /** @var Value $vc */
$vc = $v['faultCode'];
+ /** @var Value $vs */
$vs = $v['faultString'];
$r = new Response(0, $vc->scalarval(), $vs->scalarval());
} else {
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();
$rs .= "<struct>\n";
}
$charsetEncoder = Charset::instance();
+ /** @var Value $val2 */
foreach ($val as $key2 => $val2) {
$rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
//$rs.=$this->serializeval($val2);
case 2:
// array
$rs .= "<array>\n<data>\n";
+ /** @var Value $element */
foreach ($val as $element) {
//$rs.=$this->serializeval($val[$i]);
$rs .= $element->serialize($charsetEncoding);
/**
* Implements the IteratorAggregate interface
*
- * @return ArrayIterator
+ * @return \ArrayIterator
*/
public function getIterator() {
switch ($this->mytype) {
default:
return new \ArrayIterator();
}
- return new \ArrayIterator();
}
public function offsetSet($offset, $value) {
* Since php is a typeless language, to infer types of input and output parameters,
* it relies on parsing the javadoc-style comment block associated with the given
* function. Usage of xmlrpc native types (such as datetime.dateTime.iso8601 and base64)
- * in the @param tag is also allowed, if you need the php function to receive/send
+ * in the '@param' tag is also allowed, if you need the php function to receive/send
* data in that particular format (note that base64 encoding/decoding is transparently
* carried out by the lib, while datetime vals are passed around as strings)
*
* @param $callable
* @param array $extraOptions
* @param string $plainFuncName
- * @param string $funcDesc
+ * @param array $funcDesc
* @return \Closure
*/
protected function buildWrapFunctionClosure($callable, $extraOptions, $plainFuncName, $funcDesc)
{
+ /**
+ * @param Request $req
+ * @return mixed
+ */
$function = function($req) use($callable, $extraOptions, $funcDesc)
{
$nameSpace = '\\PhpXmlRpc\\';
* @param Client $client
* @param string $methodName
* @param array $extraOptions
- * @param string $mSig
+ * @param array $mSig
* @return \Closure
*
* @todo should we allow usage of parameter simple_client_copy to mean 'do not clone' in this case?
$v2 = new \PhpXmlRpc\Value(array(new \PhpXmlRpc\Value('one'), new \PhpXmlRpc\Value('two')), 'array');
$this->assertequals(2, count($v2));
$out = array(0 => 'object', 1 => 'object');
+ $i = 0;
foreach($v2 as $key => $val)
{
- $expected = each($out);
+ $expected = $out[$i];
$this->assertequals($expected['key'], $key);
$this->assertequals($expected['value'], gettype($val));
+ $i++;
}
}
}