PreferencesStore: Fix syntax
This commit is contained in:
parent
a20d5ad1f6
commit
e7c368b09d
|
@ -83,7 +83,7 @@ class PreferencesStore
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $preferences = array();
|
protected $preferences = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store config
|
* Store config
|
||||||
|
@ -168,6 +168,7 @@ class PreferencesStore
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
$values[$row->{self::COLUMN_SECTION}][$row->{self::COLUMN_PREFERENCE}] = $row->{self::COLUMN_VALUE};
|
$values[$row->{self::COLUMN_SECTION}][$row->{self::COLUMN_PREFERENCE}] = $row->{self::COLUMN_VALUE};
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->preferences = $values;
|
$this->preferences = $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,9 +190,11 @@ class PreferencesStore
|
||||||
if (! array_key_exists($section, $this->preferences)) {
|
if (! array_key_exists($section, $this->preferences)) {
|
||||||
$this->preferences[$section] = [];
|
$this->preferences[$section] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! array_key_exists($section, $preferences)) {
|
if (! array_key_exists($section, $preferences)) {
|
||||||
$preferences[$section] = [];
|
$preferences[$section] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$toBeInserted = array_diff_key($preferences[$section], $this->preferences[$section]);
|
$toBeInserted = array_diff_key($preferences[$section], $this->preferences[$section]);
|
||||||
if (!empty($toBeInserted)) {
|
if (!empty($toBeInserted)) {
|
||||||
$this->insert($toBeInserted, $section);
|
$this->insert($toBeInserted, $section);
|
||||||
|
@ -201,6 +204,7 @@ class PreferencesStore
|
||||||
array_diff_assoc($preferences[$section], $this->preferences[$section]),
|
array_diff_assoc($preferences[$section], $this->preferences[$section]),
|
||||||
array_diff_assoc($this->preferences[$section], $preferences[$section])
|
array_diff_assoc($this->preferences[$section], $preferences[$section])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($toBeUpdated)) {
|
if (!empty($toBeUpdated)) {
|
||||||
$this->update($toBeUpdated, $section);
|
$this->update($toBeUpdated, $section);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue