Merge the responses recursively
This commit is contained in:
parent
c4d87c1aff
commit
2f84a8d746
1 changed files with 2 additions and 4 deletions
|
@ -86,7 +86,6 @@ class OC_API {
|
||||||
$finalresponse = array();
|
$finalresponse = array();
|
||||||
$numresponses = count($responses);
|
$numresponses = count($responses);
|
||||||
|
|
||||||
// TODO - This is only a temporary merge. If keys match and value is another array we want to compare deeper in the array
|
|
||||||
foreach($responses as $response){
|
foreach($responses as $response){
|
||||||
if(is_int($response) && empty($finalresponse)){
|
if(is_int($response) && empty($finalresponse)){
|
||||||
$finalresponse = $response;
|
$finalresponse = $response;
|
||||||
|
@ -95,13 +94,12 @@ class OC_API {
|
||||||
if(is_array($response)){
|
if(is_array($response)){
|
||||||
// Shipped apps win
|
// Shipped apps win
|
||||||
if(OC_App::isShipped($response['app'])){
|
if(OC_App::isShipped($response['app'])){
|
||||||
$finalresponse = array_merge($finalresponse, $response);
|
$finalresponse = array_merge_recursive($finalresponse, $response);
|
||||||
} else {
|
} else {
|
||||||
$finalresponse = array_merge($response, $finalresponse);
|
$finalresponse = array_merge_recursive($response, $finalresponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// END TODO
|
|
||||||
|
|
||||||
return $finalresponse;
|
return $finalresponse;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue