/**
* A helper class to easily convert between Value objects and php native values
+ * @todo implement an interface
*/
class Encoder
{
// </G_Giunta_2001-02-29>
case 'array':
// PHP arrays can be encoded to either xmlrpc structs or arrays,
- // depending on wheter they are hashes or plain 0..n integer indexed
+ // depending on whether they are hashes or plain 0..n integer indexed
// A shorter one-liner would be
// $tmp = array_diff(array_keys($phpVal), range(0, count($phpVal)-1));
// but execution time skyrockets!
} else {
$xmlrpcVal = new Value();
}
+ break;
// catch "user function", "unknown type"
default:
// giancarlo pinerolo <ping@alt.it>
- // it has to return
- // an empty object in case, not a boolean.
+ // it has to return an empty object in case, not a boolean.
$xmlrpcVal = new Value();
break;
}
* Convert the xml representation of a method response, method request or single
* xmlrpc value into the appropriate object (a.k.a. deserialize).
*
+ * Q: is this a good name for this method? It does something quite different from 'decode' after all (returning objects vs returns plain php values)...
+ *
* @param string $xmlVal
* @param array $options
*
}
switch ($xmlRpcParser->_xh['rt']) {
case 'methodresponse':
- $v = &$xmlRpcParser->_xh['value'];
+ $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 {