fix: Optimize repo update endpoint

This commit is contained in:
Michael Gerdemann
2020-01-18 09:50:45 +01:00
parent 6993ac7c59
commit e56e4e6bf1
2 changed files with 88 additions and 9 deletions

View File

@ -17,11 +17,12 @@ abstract class AbstractEndpoint implements EndpointInterface
*/
protected function removeNullValues(array $array): array
{
return array_filter(
$array,
function($value) {
return !is_null($value);
}
);
$array = array_map(function($value) {
return is_array($value) ? $this->removeNullValues($value) : $value;
}, $array);
return array_filter($array, function($value) {
return !is_null($value) && !(is_array($value) && empty($value));
});
}
}