Другая интерпретация реестра

This commit is contained in:
CORP\phedor 2018-04-20 18:03:39 +03:00
parent 40fad0e75b
commit aaa9c2e1bf
21 changed files with 156 additions and 92 deletions

View file

@ -10,12 +10,12 @@
* Имя необходимо чтобы потом легко было удалить ненужные ветки дерева
*/
namespace ctiso;
use ctiso\Collection,
ctiso\File,
use ctiso\File,
Exception;
class Settings extends Collection
class Settings
{
public $data;
protected $file;
protected $format = 'php';
@ -45,7 +45,8 @@ class Settings extends Collection
if (!is_array($settings)) {
throw new Exception($this->file);
}
return $this->import($settings);
$this->data = $settings;
}
/**
@ -175,11 +176,20 @@ class Settings extends Collection
file_put_contents (($file) ? $file : $this->file, $result);
}
/**
* Список модулей
*/
public function getModules()
public function set($key, $value) {
$this->data[$key] = $value;
}
public function get($key, $default = null)
{
return array_keys($this->data);
return isset($this->data[$key]) && $this->data[$key] != '' ? $this->data[$key] : $default;
}
function export() {
return $this->data;
}
function import($data) {
$this->data = $data;
}
}