forked from extern/egroupware
Small speed enhancement to the code for build_resp().
This commit is contained in:
parent
864d201ed5
commit
f6d785fad2
@ -173,39 +173,26 @@
|
|||||||
|
|
||||||
function build_resp($_res,$recursed=False)
|
function build_resp($_res,$recursed=False)
|
||||||
{
|
{
|
||||||
switch(gettype($_res))
|
if(is_array($_res))
|
||||||
{
|
{
|
||||||
case 'array':
|
@reset($_res);
|
||||||
@reset($_res);
|
while(list($key,$val) = @each($_res))
|
||||||
$ele = array();
|
{
|
||||||
while(list($key,$val) = @each($_res))
|
$ele[$key] = $this->build_resp($val,True);
|
||||||
{
|
}
|
||||||
$ele[$key] = $this->build_resp($val,True);
|
$this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$ele,'struct');
|
||||||
}
|
}
|
||||||
$this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$ele,'struct');
|
else
|
||||||
break;
|
{
|
||||||
case 'string':
|
$_type = (is_long($_res)?'int':gettype($_res));
|
||||||
if($recursed)
|
if($recursed)
|
||||||
{
|
{
|
||||||
return CreateObject('phpgwapi.xmlrpcval',$_res,'string');
|
return CreateObject('phpgwapi.xmlrpcval',$_res,$_type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$_res,'string');
|
$this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$_res,$_type);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case 'integer':
|
|
||||||
if($recursed)
|
|
||||||
{
|
|
||||||
return CreateObject('phpgwapi.xmlrpcval',$_res,'int');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$_res,'int');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +311,7 @@
|
|||||||
$this->resp_struct = array();
|
$this->resp_struct = array();
|
||||||
$this->build_resp($res);
|
$this->build_resp($res);
|
||||||
/*_debug_array($this->resp_struct); */
|
/*_debug_array($this->resp_struct); */
|
||||||
|
@reset($this->resp_struct);
|
||||||
$r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->resp_struct,'struct'));
|
$r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->resp_struct,'struct'));
|
||||||
/* _debug_array($r); */
|
/* _debug_array($r); */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user