/** * Store an item in the configuration for a given number of minutes. * * @param string $key * @param mixed $value * @param string $group */ public function set($key, $value = null, $group = '') { $this->checkLoaded(); $this->modified = true; if (is_array($key)) { foreach ($key as $k => $v) { SettingsUtilities::set($this->storage, $k, $v); } } else { SettingsUtilities::set($this->storage, $key, $value); } }
/** * Parse data coming from the database. * * @param array $data * * @return array */ public function parseReadData($data) { $results = array(); foreach ($data as $row) { if (is_array($row)) { $key = $row['key']; $value = $row['value']; } elseif (is_object($row)) { $key = $row->key; $value = $row->value; } else { $msg = 'Expected array or object, got ' . gettype($row); throw new \UnexpectedValueException($msg); } SettingsUtilities::set($results, $key, $value); } return $results; }