1
0
Fork 0

Improve gettting changed options

pull/668/head
Jürgen Steitz 2017-03-04 09:03:24 +01:00
parent 707c97f0ae
commit 1e73d08033
1 changed files with 8 additions and 4 deletions

View File

@ -248,10 +248,14 @@ class Workspace
*/
private function getChangedOptions(Options $settings): array
{
// squash nested array for comparing changed options
$old = array_map('json_encode', get_object_vars($this->options));
$new = array_map('json_encode', get_object_vars($settings));
$old = get_object_vars($this->options);
$new = get_object_vars($settings);
$changed = array_udiff($old, $new, function($a, $b) {
// custom callback since array_diff uses strings for comparison
return array_keys(array_diff($old, $new));
return $a <=> $b;
});
return array_keys($changed);
}
}