PreferencesStore: Fix syntax

This commit is contained in:
Sukhwinder Dhillon 2022-05-03 09:07:22 +02:00 committed by Johannes Meyer
parent a20d5ad1f6
commit e7c368b09d
1 changed files with 5 additions and 1 deletions

View File

@ -83,7 +83,7 @@ class PreferencesStore
*
* @var array
*/
protected $preferences = array();
protected $preferences = [];
/**
* Store config
@ -168,6 +168,7 @@ class PreferencesStore
foreach ($result as $row) {
$values[$row->{self::COLUMN_SECTION}][$row->{self::COLUMN_PREFERENCE}] = $row->{self::COLUMN_VALUE};
}
$this->preferences = $values;
}
@ -189,9 +190,11 @@ class PreferencesStore
if (! array_key_exists($section, $this->preferences)) {
$this->preferences[$section] = [];
}
if (! array_key_exists($section, $preferences)) {
$preferences[$section] = [];
}
$toBeInserted = array_diff_key($preferences[$section], $this->preferences[$section]);
if (!empty($toBeInserted)) {
$this->insert($toBeInserted, $section);
@ -201,6 +204,7 @@ class PreferencesStore
array_diff_assoc($preferences[$section], $this->preferences[$section]),
array_diff_assoc($this->preferences[$section], $preferences[$section])
);
if (!empty($toBeUpdated)) {
$this->update($toBeUpdated, $section);
}